Repository Forums Support WooCommerce Extended Coupon Features PRO One problem and one question BOGO Reply To: One problem and one question BOGO

#5225
Soft79
Keymaster

Hi,

1. Remove the ‘ticket1’ from free products. Just checking the BOGO is enough. You can also remove the excluded ‘ticket2’

2. You need a snippet in your child theme’s functions.php for that. Set minimum quantity of matching products of the coupon to 10 and use this snippet:


add_filter( 'wjecf_bogo_product_amount_for_coupon', function ( $amount, $coupon )
{
  if ( strcasecmp( $coupon->get_code(), 'COUPON_CODE_HERE' ) == 0 ) {
    $min_matching_product_qty = intval( $coupon->get_meta( '_wjecf_min_matching_product_qty' ) );
    if ( $min_matching_product_qty < 1 ) $min_matching_product_qty = 1;
    $amount = 2 * floor( $amount / $min_matching_product_qty );
  }
  return $amount;
}, 10, 2 );

(untested)