Repository › Forums › Support › WooCommerce Extended Coupon Features PRO › Min order quantity and free product
- This topic has 33 replies, 2 voices, and was last updated 6 years, 12 months ago by Natasha Solley.
-
AuthorPosts
-
April 4, 2016 at 1:50 am #391Natasha SolleyParticipant
Hi there
I want to do an auto coupon that requires the customer to have to purchase a minimum of 10 items of product x to qualify for the free gift offer. But once they reach that min number of product x I want them to get product y free – but match the number of product x they have in their cart. is this possible?
April 4, 2016 at 8:59 am #392Soft79KeymasterYes, this is possible.
On the usage restriction tab select the product (x) that must be in the cart.
On the product tab set ‘Minimum quantity of marching products’ to 1.
On the product tab check the box ‘Allow multiplication’.
On the product tab enter the ‘Free product’ to give away (y)
On the misc tab check ‘Auto coupon’April 5, 2016 at 12:20 am #395Natasha SolleyParticipantHi there thanks for this. I need them to have purchased a minimum number of item x though – being 10 to be able to qualify for the free products. When I do this they only receive 1 free product when it should match how many they have purchased of item x.
April 5, 2016 at 12:03 pm #396Soft79KeymasterI see… I didn’t read your question well, sorry about that.
I’ll think about a solution and will come back to you this week…
April 5, 2016 at 9:31 pm #398Natasha SolleyParticipantOK thank you so much 🙂
April 7, 2016 at 12:43 am #401Natasha SolleyParticipantHi there sorry another question while you are looking. I want to be able to do a promotion where the customer buys 3 of an item and gets 1 free of the same item. But I also want them to be able to buy more if they want – so if they purchased 6 of that item that they would then get 2 items free.
April 8, 2016 at 9:09 am #404Soft79KeymasterThis weekend I will add some filters to my plugin, so you can alter the quantity of free products that is applied using a small custom php script in your theme’s functions.php. More or less like this:
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 ( $coupon->code == 'your-plugin-code' ) { $amount = WJECF_API()->get_quantity_of_matching_products( $coupon ); } return $amount; }
What do you think?
April 8, 2016 at 9:45 am #405Natasha SolleyParticipantThat would amazing thank you 🙂
So will that be an update on the plugin or do I just need to add this code to my themes functions.php ?April 8, 2016 at 9:51 am #406Soft79KeymasterPlease wait for the update!
April 8, 2016 at 9:52 am #407Natasha SolleyParticipantOk brilliant thank you so much 🙂
April 8, 2016 at 2:07 pm #409Soft79KeymasterPlease download 2.3.3-b2 (you can find it on your orders page) and try this:
- Create a coupon with minimum amount of matching products of 10 and free product y
- Don’t check the ‘Allow multiplication’ checkbox
- In your theme’s functions.php paste the snippet I posted this morning, and replace your-plugin-code with the actual coupon code. (Please notice that I edited the snippet)
Let me know if that works fine.
April 11, 2016 at 4:37 am #412Natasha SolleyParticipantHi there
That worked perfectly that you 🙂 Will that only work with that specific promotion though – not for any others?
Also another one I would like to do is:
I want to be able to do a promotion where the customer buys 3 of an item and gets 1 free of the same item. But I also want them to be able to buy more if they want – so if they purchased 6 of that item that they would then get 2 items free.April 11, 2016 at 7:39 am #413Soft79KeymasterJust extend your hook script, like this:
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 ) { switch ( $coupon->code ) { case 'free-x-for-every-y': $amount = WJECF_API()->get_quantity_of_matching_products( $coupon ); break; case 'free-y-for-every-three-x': $amount = intval( WJECF_API()->get_quantity_of_matching_products( $coupon ) / 3 ); break; } return $amount; }
(Untested. Please the replace coupon codes with yours)
April 13, 2016 at 1:44 am #417Natasha SolleyParticipantHi there thank for this – however its not quite doing what I had wanted. I need it to add more items of the free product when they do more than multiples of 3. Eg buy 6 and then they would get 2 free products. Like the first one you did.
April 13, 2016 at 7:21 am #418Soft79KeymasterThat’s what it should do… did you replace free-y-for-every-three-x with your coupon-code?
-
AuthorPosts
- You must be logged in to reply to this topic.