add_to_cart makes basket/cart total double
-
Hi guys,
I’ve written a custom plugin which adds variations to the cart. This happens in the ‘init’ hook. It’s working perfectly except that the cart in the header of the page displays every item I add via this method at double its cost.
e.g. If I already have an item in cart which was $50 and then use this method to add an item for $20, the cart in the header shows 2 items – $90.
It’s correctly showing the number of items but incorrectly doubling the $value of the item I added using add_to_cart.It seems to be getting updated via JavaScript, because I notice briefly when the page loads that the amount shown is correct, then it quickly changes. If I disable JavaScript, it shows the correct amount and doesn’t change.
I’m guessing it’s something to do with WooCommerce fragments but I have no idea where to find the issue…Does anyone know what I should be doing in ‘init’ to stop this happening or somewhere else?
thanks
Aaron
- The topic ‘add_to_cart makes basket/cart total double’ is closed to new replies.