I wish to set up a specific discount on a particular variable products but for certain selected variations not for all variation:
eg : my varible id – 1571
variation id – 1572
variation id – 1573
So if customer buys one product they get the another (the same) on 50% discount (Buy one get another for 50% off).
I’ve tried many discount plugins and the closest that I have found are:
- Pricing Deals for WooCommerce,
- Conditional Discounts for WooCommerce
- WooCommerce Extended Coupon Features FREE
With some of them, I was able to setup discount on subtotal or discount on a each product but not exactly what I am looking for (Buy 1 get 1 off). There are other pro plugins I don’t want to go for it.
The nearest code that I found is WooCommerce discount: buy one get one 50% off with a notice.
Is it possible to make a discount on the 2nd item for specific product variations of a variable product (only for each product variation)?
- mak
2
Answers
You were really close!
The discount amount calculation were wrong
To get a 50% Off on the 2nd item for some specific product variations of a variable product, you will use the following instead:
Code goes in functions.php file of your active child theme (or active theme) Tested and works.
To get 1 item at 50% OFF for each item purchased, instead of 50% OFF on the 2nd item, replace:
by:
To get the 2nd one Free instead of 50% OFF on the 2nd item, replace the code line:
by:
To get 1 item free for each item purchased, instead of 50% OFF on the 2nd item, replace:
by: