Created
January 3, 2019 12:17
-
-
Save lucasstark/1bac208857c6d1e713455f11943f65c6 to your computer and use it in GitHub Desktop.
Disable Dynamic Pricing with Coupon
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter( 'woocommerce_dynamic_pricing_process_product_discounts', 'dynamic_pricing_is_product_eligible', 10, 1 ); | |
function dynamic_pricing_is_product_eligible( $apply ) { | |
//Change these to the codes that should disable dynamic pricing. Add or remove as needed. | |
$coupon_codes = array( | |
'cart discount', | |
'another code', | |
'third code' | |
); | |
foreach ( WC()->cart->get_applied_coupons() as $applied_coupon ) { | |
if ( in_array( $applied_coupon, $coupon_codes ) ) { | |
$apply = false; | |
} | |
} | |
return $apply; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment