Created
April 23, 2019 10:27
-
-
Save hslaszlo/1baaefb3ebee8dbda3fc6db9092de6cd to your computer and use it in GitHub Desktop.
Exclude sale items from Dynamic Pricing rules
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( 'woocommerce_dynamic_pricing_process_product_discounts', 'is_product_eligible', 10, 4 ); | |
| if ( $product->is_on_sale() ) { | |
| $eligible = false; | |
| } | |
| add_filter( 'woocommerce_dynamic_pricing_process_product_discounts', 'is_product_eligible', 10, 4 ); | |
| return $eligible; | |
| } |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Source: https://docs.woocommerce.com/document/woocommerce-dynamic-pricing/