Forum
Discount code applied multiple times - cache issue?
Hi there,
I've came across a strange behavior within the Perch Shop. It resulted in someone ] accidentally applied their discount code twice and couldn’t remove it so he ended up with double discount.
Apparently the problem occurs, if you add something to cart, apply code, clear cart, go away, come back add the same product again, the discount code automatically appears, it hasn’t been cleared when the cart was cleared.
Is there anything we can do about it?
Best regards, Damian
Is it something you're able to reproduce?
Yes.
I wonder if there is a way to clear the code for good when cart is re-set?
Can you show me the debug output from the point the promotion is applied twice?
It's more that the promotion persists even if there are no items in the cart.
So when you: 1. Add a product 2. Set a discount code 3. Remove the product 4. Add a product - discount code is still applied
Ideally we'd like to remove the discount code when cart is emptied. Is there a quick way to do so?
Can we see the debug output please?
Ok - I'll have to run that HTML back into a browser.
Are you calling
perch_shop_empty_cart()
to empty the cart?If not, the cart still exists, it just has nothing in it. The discount is still applied.
If you call
perch_shop_empty_cart()
then the cart is destroyed and the discount goes along with it.Hi,
Drew, I have the same problem. The path looks like this: