Repository › Forums › Support › WooCommerce Extended Coupon Features PRO › customer must choose from the free products › Reply To: customer must choose from the free products

#19798
Soft79
Keymaster

To set the maximum number of free items to 2, paste this snippet in your child theme’s functions.php:


add_filter(
  'wjecf_free_product_amount_for_coupon',
  function ( $amount, $coupon ) {
    if ( strcasecmp( $coupon->get_code(), 'THE_COUPON_CODE' ) === 0 && $amount > 2 ) {
      $amount = 2;
    }
    return $amount;
  },
  10,
  2
);

To use checkboxes in the form:
Copy wp-content/plugins/woocommere-auto-added-coupons-pro/templates/coupon-select-free-product.php to wp-content/themes/YOUR_CHILD_THEME/woocommere-auto-added-coupons/coupon-select-free-product.php and replace

$input_type = $allow_multiple_products ? 'number' : 'radio';

with

$input_type = $allow_multiple_products ? 'checkbox' : 'radio';