Repository › Forums › Support › WooCommerce Extended Coupon Features PRO › Add more than 1 free product with a coupon › Reply To: Add more than 1 free product with a coupon
November 19, 2020 at 5:29 pm #16816
Soft79
Keymaster
Yes, that’s the cause. You could put it in the flatsome functions.php, but it will be overwritten when you update your theme. Alternatively you can create a custom plugin for this:
1. On your PC create a directory jane-custom-plugin/
2. In that directory create a file jane-custom-plugin.php with the following content:
/*
Plugin Name: Jane Custom Plugin
Description: Custom Coupon functionality.
Author: Jane Christensen
Version: 1.0.0
*/
add_filter( 'wjecf_free_product_amount_for_coupon', function ( $coupon_qty, $coupon ) {
if ( strcasecmp( $coupon->get_code(), 'THE_COUPON_CODE' ) === 0 ) {
$coupon_qty = 6;
}
return $coupon_qty;
}, 10, 2 );3. Zip the directory into a file jane-custom-plugin.zip (so the php-file is named jane-custom-plugin/jane-custom-plugin.php inside the zip-file)
4. Go to wp-admin > Plugins > Add Plugin and upload and activate your plugin!