Created
May 22, 2017 10:30
-
-
Save kreamweb/e000817c857d2704497637257a9fc9f1 to your computer and use it in GitHub Desktop.
This code removes all products that are on sale at the moment of creation of coupon.
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('ywrac_coupon_args','ywrac_coupon_args'); | |
| function ywrac_coupon_args( $args ){ | |
| $product_on_sale = wc_get_product_ids_on_sale(); | |
| if( is_array( $product_on_sale) && !empty( $product_on_sale ) ){ | |
| $args['exclude_product_ids'] = implode( ',', $product_on_sale ); | |
| } | |
| return $args; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment