Thank you,
So would the snippet look like this? Or do I need to plugin the coupon code and category in the “if” portion of the snippet? Do I need to change the 10 and 5 in the last line at all?
add_filter( ‘woocommerce_coupon_get_discount_amount’, function( $discount, $discounting_amount, $cart_item, $single, $coupon ) {
$COUPON_CODE = ‘louiseflash’; // replace with the coupon code
$DISCOUNTED_CATEGORY = 971 ; // replace with the category that is discounted
if ( 0 == strcasecmp( $coupon->code, ;$COUPON_CODE ) ) {
$_product = $cart_item[‘data’];
if ( $_product->get_parent_id() ) {
$_product = wc_get_product( $_product->get_parent_id() );
}
$cat_ids = $_product->get_category_ids();
if ( ! in_array( $DISCOUNTED_CATEGORY, $cat_ids ) ) {
$discount = 0;
}
}
return $discount;
}, 10, 5 );