I am in the process of building a marketing website for a client that has an existing Shopify store. They want the product details and checkout pages to remain on their Shopify store. On the new marketing site they want an indicator on the site to show a site visitor that they have items in their cart, if they have added some on the Shopify site, and a link to the checkout (on Shopify).
Using the Shopify SDK I can see how to get an existing checkout/cart to determine if the cart has items in it and also how to get a checkout link. What I need to figure out is how to connect the cart on the Shopify side to the marketing site. If I create a checkout/cart on the marketing site via the SDK, and then follow the checkout link, which directs me to the Shopify shop (running on a sub domain) everything looks good. However if I go to the main product catalogue on the Shopify site to continue adding items to the cart, it's an entirely different cart from the one I started on the main domain.
Is there a way to share a cart between the Shopify and another website? Both the marketing site and the Shopify site run on a common domain. I had thought possibly setting a cookie on the Shopify site that could share the checkout id, but it seems like there's a disconnect between the two sites.
Is this possible?
You can use `js-buy-sdk` to solve this issue vie sharing checkoutId between your shopify site & marketing website. (cookie, localstorage etc)
then on page navigation/change fetch added products/variants vie Storefront API on marketing website using checkoutId
this mean you may have to rework on shopify site if it is using AJAX API/liquid form