shop.yourbrand.com next to yourbrand.com), shoppers can keep one cart across both. Items added on either site show up on the other, and checkout includes everything.
Before you begin
- Your project uses Shopify checkout.
- Your Replo site is published on a subdomain of your store’s primary domain. If your store is on
yourbrand.comorwww.yourbrand.com, publish your site on a domain likeshop.yourbrand.com. See Custom Domains.
Add the script to your theme
1
Open your theme code
In your Shopify admin, go to Online Store → Themes. Next to your live
theme, click ⋯ → Edit code, then open
layout/theme.liquid.2
Paste the script
Paste this script anywhere inside
theme.liquid, for example just before </head>. Placing it in theme.liquid loads it on every page of your store.3
Optional: update your cart without a reload
By default the script reloads the page once when your store switches to the
shared cart, so your header count and cart drawer show every item. To refresh
your theme’s cart in place instead, edit
updateCartUI at the top of the
script. Fetch /cart.js for the current cart, then update your theme’s cart
count or drawer the way your theme does after an add to cart.4
Save and test
Click Save. Add a product on your store, open your Replo site, and check
that the cart shows the same item. Then add a product on your Replo site, go
back to your store, and check that the cart shows both.
How it works
Both sites read the same Shopify cart, so you don’t need to sync anything after setup:- Shopper starts on your store: the script shares your store’s cart with your Replo site.
- Shopper starts on your Replo site: your store switches to that cart the first time the shopper visits. If the shopper already had items in your store’s cart, the script adds them to the shared cart, then reloads the page once (or runs your
updateCartUI) so your theme’s cart shows every item. - After checkout: the next cart either site creates becomes the shared cart.
FAQ
Does this work if my Replo site is on replosites.com or another domain?
Does this work if my Replo site is on replosites.com or another domain?
No. Browsers only share cookies between a domain and its subdomains, so your
Replo site must be on a subdomain of your store’s primary domain.
Do I need to change anything for my theme's cart drawer or header?
Do I need to change anything for my theme's cart drawer or header?
No. Your theme reads the cart from Shopify as usual. The script reloads the
page once when it switches your store to the shared cart, so your header count
and cart drawer show the right items. To avoid the reload, customize
updateCartUI at the top of the script.What carries over between the two carts?
What carries over between the two carts?
Products, quantities, line item properties, and subscription selling plans.
Cart notes, cart attributes, and discount codes stay with the cart they were
added to.