Skip to main content
Question

Variable defaults to wrong variant after switching back to "False"

  • March 30, 2026
  • 0 replies
  • 20 views

Leb

I’m working on a prototype of a website to purchase tickets for events, and I have the checkout process set up like this:

Go to ā€˜Schedule’,
Select the show (in this case, the show for ā€˜Mello Quake’),
Select ā€˜Add To Cart’, which redirects you to your cart.

Note: When adding to cart, this toggles a ā€œCartā€ variable to be set to ā€œTrueā€, which will change the ā€˜Add to Cart’ button to a variant that reads ā€œView in Cartā€. Both buttons have an animated hover state.

From there, you are able to empty the cart by making the counter in the cart go to ā€˜0’. A pop up will appear as a warning, letting you know that this will empty the cart, and ask the user if that’s what they want to do.

Ā 

When testing this, I have been hitting ā€œYesā€ to empty the cart. Doing this will set the ā€œCartā€ variable to ā€œFalseā€. Ideally, when the ā€œCartā€ variable is set back to false, the button on the show page will change back to the ā€œAdd to Cartā€ variant. While it does do this, it defaults to theĀ hoverĀ variant of the button, instead of the non-hover variant. I’m sure there’s some dumb syntax error I’ve done somewhere but I can’t seem to find it. Please help!

Here’s a link to the project file.

Ā 

Thanks in advance!