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.
Would you love to unleash the unbridled power of the Google Shopping Channel into your sho...By Gabe Jan 6, 2023
How can you turn a hobby into a career? That’s what Emmanuel did while working as a wa...By Skye Dec 30, 2022