Repository Forums Support WooCommerce Extended Coupon Features PRO Min order quantity and free product Reply To: Min order quantity and free product

#404
Soft79
Keymaster

This weekend I will add some filters to my plugin, so you can alter the quantity of free products that is applied using a small custom php script in your theme’s functions.php. More or less like this:


add_filter( 'wjecf_free_product_amount_for_coupon', 'wjecf_free_product_amount_for_coupon', 10, 2 );
function wjecf_free_product_amount_for_coupon ( $amount, $coupon ) {
  if ( $coupon->code == 'your-plugin-code' ) {
    $amount = WJECF_API()->get_quantity_of_matching_products( $coupon );
  }
  return $amount;
}

What do you think?