Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #16985
    Ariela Shahaf
    Participant

    hi can I have 2 function in one coupon:
    1. min 100NIS in cart will have 10% off
    2. min 200NIS in cart will have 10% off and one free product

    #16986
    Soft79
    Keymaster

    Not out-of-the-box, but you can create a coupon that applies the 10% discount and adds a free product and include a snippet like this one (untested) that will set the quantity of matching products to 0 if the cart amount < 200 : (Replace COUPON_CODE with the actual coupon code)

    
    add_filter( 'wjecf_free_product_amount_for_coupon', function( $coupon_qty, $coupon ) {
      if ( strcasecmp( $coupon->get_code(), 'COUPON_CODE' ) === 0 ) { 
        $subtotal = WJECF_API()->get_subtotal_of_matching_products( $coupon ); 
        if ( $subtotal < 200 ) {
          $coupon_qty = 0;
        }
      }
      return $coupon_qty;
    }, 10, 2);
    
    #16992
    Ariela Shahaf
    Participant

    It work perfectly! Thank you!

    #16994
    Ariela Shahaf
    Participant

    Can i make the second stap 10% be applied on the price after the 10% of the first steps?

    #16996
    Soft79
    Keymaster

    No.

    #16998
    Ariela Shahaf
    Participant

    ok
    can i have : if he buy 100 nis he. will have one product
    and if he buy from 200 up he will have the first product and another product?

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.