Repository › Forums › Support › WooCommerce Extended Coupon Features PRO › WooCommerce Subscriptions Free Gift coupon not working
- This topic has 10 replies, 2 voices, and was last updated 5 years, 7 months ago by Daniel Humphrey.
- AuthorPosts
- January 20, 2021 at 4:40 pm #17181Daniel HumphreyParticipant
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”.
January 20, 2021 at 4:41 pm #17182Daniel HumphreyParticipantJanuary 20, 2021 at 5:49 pm #17183Soft79KeymasterWhat is the discount type of the coupon? Try setting it to: 0 Percent discount
January 20, 2021 at 6:33 pm #17184Daniel HumphreyParticipantI tried all of the discount types with the same result.
January 20, 2021 at 6:45 pm #17185Soft79KeymasterPlease temporarily enable debug mode from our plugin’s Settings page and send us the coupon code.
January 20, 2021 at 7:32 pm #17186Daniel HumphreyParticipantIf 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?
January 20, 2021 at 7:33 pm #17187Daniel HumphreyParticipantOk, 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.
January 20, 2021 at 8:03 pm #17188Soft79KeymasterI 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.
January 20, 2021 at 8:05 pm #17189Daniel HumphreyParticipantIs this to add to functions.php?
January 20, 2021 at 8:14 pm #17191Soft79KeymasterYes, the functions.php of your child theme if you have one.
January 20, 2021 at 8:16 pm #17192Daniel HumphreyParticipantIt works! Thank you
- AuthorPosts
- You must be logged in to reply to this topic.