Repository Forums Support WooCommerce Extended Coupon Features PRO Set Free Product Quantity

Topic Resolution: Resolved
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #2193
    emal
    Participant

    Hi, I’m unable to find the free product quantity option. What I want if user applied “CUP10” coupon it will add the 10 free product in cart and not apply the discount. But there is no such option in plugin.

    #2194
    Soft79
    Keymaster

    Hi,

    You can achieve that by adding this snippet to your child themes functions.php:

    
    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 ( strtolower( $coupon->get_code() ) == 'cup10' && $amount >= 1 ) { 
        $amount = 10; 
      } 
      return $amount; 
    } 
    
Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.