diff --git a/plugins/woocommerce-blocks/assets/js/payment-method-extensions/payment-methods/cod/index.js b/plugins/woocommerce-blocks/assets/js/payment-method-extensions/payment-methods/cod/index.js index 29340f2dc0a..d18b3d3ecdd 100644 --- a/plugins/woocommerce-blocks/assets/js/payment-method-extensions/payment-methods/cod/index.js +++ b/plugins/woocommerce-blocks/assets/js/payment-method-extensions/payment-methods/cod/index.js @@ -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; } diff --git a/plugins/woocommerce-blocks/src/Payments/Integrations/CashOnDelivery.php b/plugins/woocommerce-blocks/src/Payments/Integrations/CashOnDelivery.php index 9aff31006a7..cb6c938eed8 100644 --- a/plugins/woocommerce-blocks/src/Payments/Integrations/CashOnDelivery.php +++ b/plugins/woocommerce-blocks/src/Payments/Integrations/CashOnDelivery.php @@ -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; }