-
I'm trying to animate my ajax cart into view using Alpine.js after item has been added via the product add form. I'm suspecting that the ajax cart is being updated by LAC after the response is received and that's what is interfering with the animation and instead just showing the ajax cart without animating in. here's my liquid-ajax-cart logic:
If I wrap my ajax cart visibility state change in a setTimeout I get the desired animation. Is there a way I can listen for when the cart has been updated so i know when to begin animation? My minicart section --> https://gist.github.com/james0r/cf256bf980b121466e7ce5d9b9e4905d |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 10 replies
-
Edit: Solved Then I faced the issue with LAC wanting to be the root element of the section so I ended up moving my Alpine.js ajax cart root into theme.liquid and wrapping my Looks like this:
Now when I set my Alpine.js minicart visibility flag to true from subscribeToResult() callback, I keep my transitions and the cart updates properly. |
Beta Was this translation helpful? Give feedback.
Edit: Solved
There were a couple issues at play here, one being that i was losing applied classes to the cart that was being swapped out by liquid ajax cart. The solution to this was to move my root level Alpine.js revealed ajax cart to a wrapper wrapping the root of LAC.
Then I faced the issue with LAC wanting to be the root element of the section so I ended up moving my Alpine.js ajax cart root into theme.liquid and wrapping my
{% section 'minicart' %}
in the Alpine.js ajax cart root.Looks like this: