Restrict Coupons by Shipping Methods

add_filter( ‘woocommerce_coupon_is_valid’, function( $valid, $coupon, $discount ) { // List the coupon codes to restrict (lowercase) $restricted_coupons = [ ‘your-coupon-code’ ]; if ( ! in_array( strtolower( $coupon->get_code() ), $restricted_coupons, true ) ) { return $valid; } // Allowed shipping method…Continue reading