I work with influencers codes in my shop and also I’m implementing the Frequent Bought Together bundles. I want to disable the option to ad an influencer code when costumers.
My main issue is that if a user has put a Frequently Bought Together deal in the cart, I don’t want to give a chance to them to get even bigger discount by adding a coupon (if they have one). And at the moment coupons are accepted and adds more discount to these deals.
I tried the the following Snippet and it didn’t work:
add_filter( ‘woocommerce_coupon_is_valid_for_product’, ‘woobt_coupon_restrict’, 10, 4 );
function woobt_coupon_restrict( $valid, $product, $coupon, $cart_item ) {
if ( isset( $cart_item[‘woobt_parent_id’] ) || isset( $cart_item[‘woobt_ids’] ) ) {
return false;
}
return $valid;
}