Created
June 3, 2024 18:39
-
-
Save goranefbl/f4c21f796b37c40d110c9752a17a1195 to your computer and use it in GitHub Desktop.
Referral working with restricted coupons
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_apply_with_individual_use_coupon', 'filter_apply_with_individual_use_coupon', 10, 4); | |
| function filter_apply_with_individual_use_coupon($apply, $the_coupon, $applied_coupon, $applied_coupons) { | |
| // Check if the coupon code starts with 'ref' | |
| if (strpos($the_coupon->get_code(), 'ref') === 0) { | |
| $apply = true; | |
| } | |
| return $apply; | |
| } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment