Fix an issue with COD not showing when first enabled (https://github.com/woocommerce/woocommerce-blocks/pull/3088)
* Fix issue with COD not showing when first set * generating changeset for pull request * generating changeset for pull request * change condition to arrays only Co-authored-by: github-actions <github-actions@github.com>
This commit is contained in:
parent
76ebf9c860
commit
62de2eb6fc
|
@ -49,7 +49,7 @@ const canMakePayment = ( { cartNeedsShipping, selectedShippingMethods } ) => {
|
|||
return false;
|
||||
}
|
||||
|
||||
if ( ! settings.enableForShippingMethods ) {
|
||||
if ( ! settings.enableForShippingMethods.length ) {
|
||||
// Store does not limit COD to specific shipping methods.
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -63,7 +63,11 @@ final class CashOnDelivery extends AbstractPaymentMethodType {
|
|||
* @return array Array of shipping methods (string ids) that allow COD. (If empty, all support COD.)
|
||||
*/
|
||||
private function get_enable_for_methods() {
|
||||
return $this->get_setting( 'enable_for_methods', [] );
|
||||
$enable_for_methods = $this->get_setting( 'enable_for_methods', [] );
|
||||
if ( '' === $enable_for_methods ) {
|
||||
return [];
|
||||
}
|
||||
return $enable_for_methods;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue