Skip to content

Instantly share code, notes, and snippets.

@danielbitzer
Last active September 14, 2022 11:29
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danielbitzer/870ed30470275f33ba37843fde416702 to your computer and use it in GitHub Desktop.
Save danielbitzer/870ed30470275f33ba37843fde416702 to your computer and use it in GitHub Desktop.
Restrict referral coupons by product ID
<?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