Repository › Forums › Support › WooCommerce Extended Coupon Features PRO › BOGO, B2G2, B4G4, etc. – advanced restrictions › Reply To: BOGO, B2G2, B4G4, etc. – advanced restrictions
February 17, 2023 at 2:46 pm #19574
Soft79
Keymaster
“Cart size is at least $300” is possible by using minimum spend.
“at least 2 items in the cart” is possible by using minimum quantity of matching products.
But combinations (minimum 2 items, but every 3rd item free) require customization.
Search for ‘apply_filters’ in the code to find out what filters are available. Some are documented, for example this is the documentation for wjecf_get_limit_to_options:
/**
* This filter allows developers to append custom rules for 'Limit to:'
*
* $options = [ $key => [ 'function' => $callback_function, 'title' => $title ], ... ]
*
* $key = The key that identifies the 'Limit to'-rule.
* $title = The title of the 'Limit to'-rule.
* $function = The callback with functionality of the rule. Callback must have this signature:
*
* function callback_function( $coupon, $discountable_items )
*
* ($discountable_items are stdClass objects as generated by WC_Discounts)
*
* The callback must return an array with the maximum amount of items to be discounted. [ $item_key => $discount_limit, ... ]
* Discount-quantity of cart_items that are not in the array will not be limited.
*/