Repository Forums Support WooCommerce Extended Coupon Features PRO how to select 2 free products on products with 2 quantity Reply To: how to select 2 free products on products with 2 quantity

#4392
Soft79
Keymaster

You don’t need to hack the core files, the example I sent you also adds an input field to admin, see init_admin_hook(), admin_coupon_meta_fields() and action_woocommerce_coupon_options_usage_restriction().

The extra free item can probably be solved in template override. Selected item(s) are store in WC session data: _wjecf_session_data['selected_free_products']. Maybe you can apply a filter to override this also.

Really, try not to edit core files of any plugin or theme. 99% of the time it’s possible to achieve something without hacking core files.