Cart in remote site not syncing with Shopify cart

Shopify Partner
5 0 1

I'm trying to use BuyButton.js to access cart info from our Shopify store. I want to have a cart icon on our main site ( that pulls the number of items from the cart at and updates when you add items from www. But the cart seems to be a separate instance from the cart in the storefront. If I add 3 items from www., then click through to shop., the cart is empty. If I go back to www. the 3 items are still there.

This is where I'm starting. (For now, just creating a cart object and accessing the number of items to display in the cart icon.)

<script type="text/javascript" src=""></script>
<script type="text/javascript">
    var shopClient = ShopifyBuy.buildClient({
        apiKey: '57910de13b81988c3730017c9237239e',
        domain: '',
        appId: '6'
    var ui = ShopifyBuy.UI.init(shopClient);

      .then(function (cart) {
        jQuery('#cart-item-count').html( cart.lineItemCount );


Many thanks in advance.

Shopify Partner
5 0 1

My understanding now is that the Buy Button and Online Store are discrete sales channels that operate independently. So if a user interacts with our shop (loads up a cart) via the Buy Button, then visits the Online Store, the cart in the Online Store is empty.

That seems counterintuitive. Is there something fundamental I'm missing?

1 Like
Shopify Partner
1 0 0

I just had the same problem when developing a remote front-end for a Shopify store. I spent a lot of time researching it and I could not find a way to persist the cart across the remote store to the Shopify side. What I ended up doing was creating a cart with the Shopify Buy API on my remote site, setting that up to function as normal with the exception that the add to cart action did not open the cart pop up, but rather linked the user to their cart on the Shopify site using the url post for the cart page:

So, each time a user adds an item on my remote store, it adds the item to the remote store cart, then pops them over to the cart page which, syncs the carts on the pages, with the new item.

Shopify really needs to work on this though. The API is a great idea but it is extremely limited in what it is capable of, especially when communicating with the online store. I don't understand why when we create a cart instance via the Buy SDK, it isn't stored somewhere that can be accessed by the Shopify store. 

I understand that there could be potentially thousands of carts being stored per store, which is maybe why they don't do it, who knows. Seems counterintuitive though to tout that you can offload the front-end of your Shopify then not have this basic interaction possible.

Shopify Partner
3 0 0

I'm having the same issue, still don't  get how did they miss this.

Tabetha, how did you exactly managed to '..setting that up to function as normal..'? 

New Member
4 0 0