Access a cart created on a Shopify store with the JS-buy (storefront) api

rpw
Shopify Partner
74 0 10

TLDR: Is it possible to access a cart created on a Shopify store with the JS-buy (storefront) api?

 

I have a webhook which fires whenever a cart is created or updated. I store the carts ID in my DB so that I can retrieve it later.

 

However, this only seems to work with carts that I have created with the Storefront API... it does not appear to work with carts created within the main Shopify site.

 

I'm going to assume that if this is the case, its a security/seperation of concerns thing...



*** Edit ***

 

I could proxy all cart requests (add to cart, remove from cart etc) through my app. The app could use storefront api to build the users cart,  - and send the cart back to the web store. When a customer adds to cart cart - it would all be done through my app. They click add - the request is posted to my app, with the cart returned to the client where the data can be used to update stuff (eg... update the mini cart).

The problem with this solution is that it is tied too tightly to a store theme / template (its been years since I did anything on Shopify) so it would mean manually updating things like the themes add to cart method to post to my app, and update whatever Dom element etc...

So this isn't really a viable solution. May as well roll my own store if I'm jumping through those hoops.

Replies 0 (0)