1
votes

I understand that the Shopify Rest Api does not have the capability to return shopping cart items. I also understand that the Shopify Ajax Api has the /cart.js endpoint which allows you to retrieve the current user shopping cart. It uses a session cookie to identify the current user. But this means that the Ajax Api /cart.js could be used only from the context of a Shopify front-end.

Still I can see various Shopify apps or services that seem to be able to get the shopping cart for a given customer outside the context of a Shopify front-end. Does anyone know how I can call the Ajax Api /cart.js or any other endpoint in the Rest or Ajax api, and give it a user id perhaps or a shopping cart id and get the cart items for it?

1

1 Answers

6
votes

I'm afraid the only way you can access the cart items is via the Ajax API you mentioned. Perhaps this is what the other apps you've seen use. Maybe something like this...

Here's a couple of related topics on the Shopify forums: