I have set up a Woocommerce shop and wish to set up a specific discount on all products based on multiples of 12 (a box). I've tried many discount plugins but haven't found what I am looking for.
For example, if I order 12 of product X, I get a 10% discount. If I order 15 of product X, I get a 10% discount on the first 12, and the last three are full price. If I order 24, then that 10% discount applies to all 24 of product X.
The closest I have found is this: Discount for Certain Category Based on Total Number of Products
But this is applied as a discount (actually a negative fee) at the end, and I'd like to display the discount in the cart next to the product, like normal discounts.
I also need this discount to be disabled if a product is already on sale.
Thanks.
Yes this is also possible, making a custom calculation for each cart item and replacing individually their price (matching your conditions and calculations), using a custom function hooked in
woocommerce_before_calculate_totals
action hook.This is the code:
Code goes in function.php file of your active child theme (or theme) or also in any plugin file.
This code is tested and works.