woocommerce offtopic – Where to store customer specific discount value depending on cart items?
Im building a function of buy 3 pay for 2 – the cheapest item will be substracted from each of the 3 items.
This is done in the hook
woocommerce_before_calculate_totals and works great.
But now I need to show the savings at each product line and need the access a value from my first hook in this hook for the product lines
I tried to bind the discount value to each product like a custom meta:
but that made huge issues and showed on products that should not have discout, so somehow it did not update and i dont think that was a great way to do it.
So – how can I store a value in one hook and retive it another hook (securely as it is a discount and people should not be able to manipulate it)?
Leave an answer