Last active
August 4, 2023 14:50
-
-
Save zackeryfretty/daf91fcc139716ebeabfe0d5d99d51ff to your computer and use it in GitHub Desktop.
This file contains hidden or 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
<?php | |
add_filter( 'woocommerce_dynamic_pricing_process_product_discounts', 'is_product_eligible', 10, 4 ); | |
function is_product_eligible( $eligible, $product, $discounter_name, $discounter_object ) { | |
// Remove Filter | |
remove_filter( 'woocommerce_dynamic_pricing_process_product_discounts', 'is_product_eligible', 10, 4 ); | |
// Get Cart | |
$cart = WC()->cart; | |
// Look for 'COUPON-NAME' in array | |
if(in_array('COUPON-NAME', $cart->applied_coupons)): | |
// If Found, Disable Dynamic Pricing | |
$eligible = FALSE; | |
endif; | |
// Add Modded Filter | |
add_filter( 'woocommerce_dynamic_pricing_process_product_discounts', 'is_product_eligible', 10, 4 ); | |
return $eligible; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment