App reviews, troubleshooting, and recommendations
I am trying to get product info that is added to cart. Shopify.getCart() function returns undefined but opens an alert message saying "there is 1 item in the cart". How to get the cart details using this? any help appreciated
Hey @tsuj. Thanks for this question! I had the exact same one. Did you ever get this sorted out?
I can call the function but it always alerts the value, I just want to set it to a variable!
Turns out it's actually useless unless you do any tweak on the theme. I have used the ajax API for the same functionality. It's pretty flexible.
Shopify.getCart() returns a promise. So, you can use the following to get data:
//here you have the cart object.
This won't fire up the alert.
Thanks to all Community members that participated in our inaugural 2 week AMA on the new E...By Jacqui Mar 10, 2023
Upskill and stand out with the new Shopify Foundations Certification programBy SarahF_Shopify Mar 6, 2023
One of the key components to running a successful online business is having clear and co...By Ollie Mar 6, 2023