Remove .bricks-cart-added at the same moment the success text is reset, so
the class mirrors the state it represents.
Current behaviour
After a successful AJAX add to cart, the button gets .bricks-cart-added and
the success label (“Added”). When the reset timer expires, the label reverts
to the default text — but .bricks-cart-added stays on the button
permanently.
Why this is a problem
The class is the only hook for styling the success state. Because it is
never removed, any styling applied to it becomes permanent: a button styled
green for confirmation stays green for the rest of the page session, so it
no longer signals anything. This makes visual success feedback impossible —
only the text can change, and it is too brief to read reliably.
Thanks for explaining the use case. Having success styling reset alongside the button text makes sense.
After review, we’re keeping .bricks-cart-added unchanged because existing sites may rely on it to mark buttons that successfully added a product during the current page session. Removing it automatically could affect their custom styling or scripts.
Instead, we’re introducing .bricks-cart-success for the temporary success state. It will appear with the success text and be removed when the configured timer restores the original text.
You’ll be able to target this new class for styling that should reset with the label.
This supports your use case while preserving the existing behavior for other sites.
This sound perfect and seems even more consistent anyway because the class .bricks-cart-added still has its meaning because the product was indeed added no matter how long ago.