diff --git a/includes/shipping/free-shipping/class-wc-shipping-free-shipping.php b/includes/shipping/free-shipping/class-wc-shipping-free-shipping.php index e53a7c48909..38b77b32700 100644 --- a/includes/shipping/free-shipping/class-wc-shipping-free-shipping.php +++ b/includes/shipping/free-shipping/class-wc-shipping-free-shipping.php @@ -1,4 +1,10 @@ requires, array( 'coupon', 'either', 'both' ) ) ) { - if ( $coupons = WC()->cart->get_coupons() ) { + if ( in_array( $this->requires, array( 'coupon', 'either', 'both' ), true ) ) { + $coupons = WC()->cart->get_coupons(); + + if ( $coupons ) { foreach ( $coupons as $code => $coupon ) { if ( $coupon->is_valid() && $coupon->get_free_shipping() ) { $has_coupon = true; @@ -159,7 +166,7 @@ class WC_Shipping_Free_Shipping extends WC_Shipping_Method { } } - if ( in_array( $this->requires, array( 'min_amount', 'either', 'both' ) ) ) { + if ( in_array( $this->requires, array( 'min_amount', 'either', 'both' ), true ) ) { $total = WC()->cart->get_displayed_subtotal(); if ( WC()->cart->display_prices_including_tax() ) {