Well, my plugin doesn’t do that out-of-the-box, but if you add the following code to your themes’ functions.php, it will!
Please replace ‘code1’, ‘code2’, ‘etc…’ by the coupon codes that you want the AND-condition to be applied to.
add_filter('woocommerce_coupon_is_valid', 'my_wc_coupon_validate', 10, 2);
function my_wc_coupon_validate ($valid_for_cart, $coupon) {
// Only accept coupon if *ALL* of the coupons' products are in the cart
//FILL IN THE COUPON CODES BELOW:
$coupon_codes = array( 'code1', 'code2', 'etc...' );
if ($valid_for_cart && in_array( $coupon->code, $coupon_codes ) ) {
if ( sizeof( $coupon->product_ids ) > 0 && ! $coupon->is_type( array( 'fixed_product', 'percent_product' ) ) ) {
//Get array of all cart item ids
$cart_item_ids = array();
foreach( WC()->cart->get_cart() as $cart_item_key => $cart_item ) {
$cart_item_ids[] = $cart_item['product_id'];
$cart_item_ids[] = $cart_item['variation_id'];
}
//check if every single product is in the cart
foreach( $coupon->product_ids as $product_id ) {
if ( ! in_array( $product_id, $cart_item_ids ) ) {
$valid_for_cart = false;
break;
}
}
}
}
return $valid_for_cart;
}
Does this solve your request?