AndreiGh Posted March 26, 2022 Share Posted March 26, 2022 Hello, At the moment of $(document).ready(..., the Cart is not loaded, below is the page HTML. So the cart is rendered by some next-to-run Javascript. I need to run own Javascript code *after* the Cart has been rendered. How can I do that ? Should I wait after some custom event ? Thank you ! <div class="system-page"> <div id="sqs-cart-root"> <script type="application/json"> {"cart":{...CART_CONTENTS_AS_JSON.}} </script> <div id="sqs-cart-container"></div> </div> </div> Link to comment
Beyondspace Posted March 27, 2022 Share Posted March 27, 2022 9 hours ago, AndreiGh said: Hello, At the moment of $(document).ready(..., the Cart is not loaded, below is the page HTML. So the cart is rendered by some next-to-run Javascript. I need to run own Javascript code *after* the Cart has been rendered. How can I do that ? Should I wait after some custom event ? Thank you ! <div class="system-page"> <div id="sqs-cart-root"> <script type="application/json"> {"cart":{...CART_CONTENTS_AS_JSON.}} </script> <div id="sqs-cart-container"></div> </div> </div> The following code works fine on my testing $(document).ready(function() { const cart = $('.showOnDesktop .icon--cart[href *="cart"]')[0]; console.log(cart); }) Try and let me know how it goes Greeting, it's BeyondSpace, I am Squarespace dev focus on provide solutions to enhance feature that squarespace.com can't provide.Feel free to check my current Squarespace Plugins Developement: Enable Pinch/Zoom on lightbox, Delivery Date Picker, Lightbox Studio pluginIf you find my answer fit your need, let's leave a like or upvote so others with the same issue can find their solution. Thank you Link to comment
AndreiGh Posted March 27, 2022 Author Share Posted March 27, 2022 (edited) That code retrieves the floating cart icon, not the actual cart contents, on the "cart" page (the products added in the cart, the "checkout" button) <-- these cart HTML is the one I want to modify (the DIVs with class cart-container, cart-summary). Thank you ! Edited March 27, 2022 by AndreiGh Link to comment
Jesiblumen Posted June 8, 2022 Share Posted June 8, 2022 Hi! I am looking to add a floating cart to my site - would love your help if you found a way! Link to comment
creedon Posted June 8, 2022 Share Posted June 8, 2022 Quote I need to run own Javascript code *after* the Cart has been rendered. How can I do that ? Should I wait after some custom event ? A little late with an answer. Let us know how it goes. Find my contributions useful? Please like, upvote, mark my answer as best , and see my profile. Thanks for your support! Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment