Repository Forums Support WooCommerce Extended Coupon Features PRO WooCommerce Subscriptions Free Gift coupon not working

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #17181
    Daniel Humphrey
    Participant

    I purchased the PRO version to perform what I’d hoped was a simple task – when someone adds a Subscription product to their cart, and enters a coupon code, a free gift is also added to the cart. I’ve tried numerous ways to set this up, and it seems not have the functionality (although the same is described on the sales page). I either get ‘Coupon ‘sundaytimes’ will be applied when its conditions are met.’ even though the condition is met (the subscription product is in the cart) or I get “Sorry, this coupon is only valid for an initial payment and the cart does not require an initial payment”.

    #17182
    Daniel Humphrey
    Participant
    #17183
    Soft79
    Keymaster

    What is the discount type of the coupon? Try setting it to: 0 Percent discount

    #17184
    Daniel Humphrey
    Participant

    I tried all of the discount types with the same result.

    #17185
    Soft79
    Keymaster

    Please temporarily enable debug mode from our plugin’s Settings page and send us the coupon code.

    #17186
    Daniel Humphrey
    Participant

    If it helps, when you choose the 6 month or 12 moth gift option from the subscription product, it works – it adds the free item, just not on the main bi-monthly subscription, assume because there is no up front cost.

    So, is there a way for the plugin to still add the product when the shopping cart total reads £0?

    #17187
    Daniel Humphrey
    Participant

    Ok, have added another coupon code to do the same as have used a workaround for now on another code.

    This code – SOFT79 – should add item ‘FREE GIFT’ to your cart when you choose Join the club from the shop. It should be auto applied.

    #17188
    Soft79
    Keymaster

    I looked up the source code of the Subscriptions plugin and found a possible solution. Are you comfortable with pasting a PHP snippet?

    
    add_filter(
      'woocommerce_subscriptions_validate_coupon_type',
      function( $validate, $coupon, $valid ) {
          if ( ! $coupon->get_amount() ) {
            $validate = false;
          }
          return $validate;
      },10, 3
    );
    

    Please note I didn’t test this.

    #17189
    Daniel Humphrey
    Participant

    Is this to add to functions.php?

    #17191
    Soft79
    Keymaster

    Yes, the functions.php of your child theme if you have one.

    #17192
    Daniel Humphrey
    Participant

    It works! Thank you

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