Last active
September 28, 2022 13:21
-
-
Save benergize/2983557cb1ff4e94e1f6a6e9d66fcf3d to your computer and use it in GitHub Desktop.
Get contents of Shopify cart with AJAX fetch, JavaScript
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getCartContents(callback = function(){}) { | |
fetch("/cart.js").then(function(el){return (el.json());}).then(function(cart) { | |
console.log(cart); | |
callback(cart); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment