Quantcast
Channel: Opinion: Shopify Community - Shopify APIs & SDKs
Viewing all articles
Browse latest Browse all 25503

Julian Nadeau commented on How to get current shopping cart value via JS

$
0
0

Hi Jagan!

Sorry about the delay there!

From what I understand, you just want a way in Javascript to get the value of your cart. As long as you are on your Shopify site, you can use

Shopify.getCart()

 his will return a JSON object that has a "total price" field.

If you are not on your Shopify shop, I think you can use JQuery Ajax commands with a jsonp data type (allows cross site requests). Something like this could help (will require some tinkering).

$.ajax({
  url: visitorengage.com/cart.js,
  success: successCallback,
  dataType: jsonp
});

Take a look at these links for more help:

Docs: http://docs.shopify.com/support/your-website/themes/can-i-use-ajax-api

Playground with the API: http://mayert-douglas4935.myshopify.com/pages/api

 

 

I hope this helps!

Julian Nadeau

Shopify Mobile


Viewing all articles
Browse latest Browse all 25503

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>