Last active
September 14, 2022 11:29
-
-
Save danielbitzer/870ed30470275f33ba37843fde416702 to your computer and use it in GitHub Desktop.
Restrict referral coupons by product ID
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
<?php | |
add_filter('automatewoo/referrals/coupon_data', 'my_automatewoo_referrals_coupon_data' ); | |
/** | |
* Restrict referral coupon to product IDs | |
* | |
* @param array $coupon_data | |
* @return array | |
*/ | |
function my_automatewoo_referrals_coupon_data( $coupon_data ) { | |
// change coupon type | |
$coupon_data['discount_type'] = 'percent_product'; | |
// to include specific products | |
$coupon_data['product_ids'] = array( 101, 102 ); | |
return $coupon_data; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment