So for example, I have a product which costs £2/item if you buy singles or £1/item if you buy it in packs of 6.
Customers enter their quantity required, let’s say 7, and then add it to the basket.
The total cost should be £8. £6 (1 pack) + £2 (1 single). But if I add it to the basket currently the price will come out as £7 as you’d expect (it just does 7 x the price set which is £1).
I need to intercept/filter the line price so that it calculates the number of packs, and the number of singles, and then returns the right amount. I can design the function and the math, I just need to know where to hook into.
i.e. is there a filter like woocommerce_get_cart or something similar? And if so, how do I alter the line price?
(p.s. I know I could achieve the with variable products for instance but that’s not an option for stock control reasons).
this is the original total calculations on WooCommerce.
near the bottom you have:
of which I believe you can use to do something like this: