Enable Cart Sync

Last updated: November 11, 2026

For brands on Appbrew · 11 Nov 2026

Cart sync keeps a signed-in customer's cart the same in your app and on your website. Enabling it is three steps on your side, with no app install.

Before you start

  • Milo is set up in your app repository (milo app which shows your app).

  • Cart sync is a paid feature. Get the payment link from Appbrew. Once the payment is completed, Appbrew switches cart sync on for your store. Until then the enable command below is refused with a message saying so.

Steps

All three can be done by asking Milo in your app repository; the commands are listed so you can see what it runs.

1. Provision

milo cart-sync enable creates your store's cart database and registers it. Safe to run again — a second run changes nothing.

2. Switch the embed on in your Shopify theme

Open the activation link Milo prints — https://<your-shop>/admin/themes/current/editor?context=apps&activateAppId=<embed-id>/cart-sync — turn Cart Sync on, and save.

The web script is about 8 KB gzipped and loads deferred, after the page has rendered.

3. Turn the setting on and publish

Ask Milo: "Turn cart sync on in the live app theme settings and publish." It sets this in the settings of your Appbrew app theme:

"global": { "cartSync": { "enabled": true } }

and runs milo config commit settings <id>, milo config push, milo theme publish, asking you to confirm before the publish. The app picks it up over the air; no app release.

Optional keys: debounceMs (default 2500) and excludedVariantIds (variants that never sync at all, such as gift wrap).

4. Verify

milo cart-sync status shows four checks: database, embed on, setting on in the live theme, web route reachable. Then sign in on the website, add a product, and open the app: the item appears within a few seconds.

If your website adds free gifts: refer here for the extra step.

What to expect

  • Only signed-in customers sync. Guest carts on either side are untouched.

  • A change on one side reaches the other within a few seconds.

  • An order placed on either side clears the cart on both.

  • A cart not touched for 30 days is dropped from the sync store; the native carts are unaffected.

  • To keep a product out of sync entirely, such as gift wrap or a bundle built on the web, list its variant in excludedVariantIds and match the same id in the website filter.

  • Add to cart, discount codes and checkout on your website are not intercepted; the script only observes cart changes.

Changing your Shopify theme. The embed from step 2 lives in your Shopify store theme (Online Store → Themes). Publishing a different theme turns the web side off, unless that theme was duplicated from one with the embed on. Repeat step 2 on the new theme. Editing or updating your current theme changes nothing. milo cart-sync status shows when the embed is off.

What Appbrew does for each brand

One action: after the commercial sign-off, switch the ENABLE_CART_SYNC store flag on. Everything else runs on your command or is already in place.

Item

Who

When

Cart database and registration

Appbrew's platform, triggered by your milo cart-sync enable

Step 1

Order webhook

Already subscribed for every store; verification uses the app's own secret

Nothing to do

Web route (/apps/appbrew-sync) and theme embed

Ship with the main Appbrew app already installed on your store

Nothing to do

Support

milo cart-sync status tells both sides which check failed

As needed

Turning it off

Set global.cartSync.enabled to false and publish; the app stops syncing on its next config load. Switch the embed off in the theme editor to stop the web side. Ask Appbrew to disable the registration if you want the server side off as well; your stored carts expire on their own within 30 days and re-enabling later is immediate.

If your website adds free gifts

Needed when your website puts a free gift in the cart automatically. Skip it otherwise. Gifts are never synced: each side adds its own, so the website has to say which of its lines are gifts.

App. Nothing to do for gifts added by Appbrew's gift rules. The app keeps those out of sync by itself.

Any other product can be kept out on the app side through the list in the setting. Ask Milo: "Add these variant ids to cart sync's excluded variants and publish." It adds them beside enabled:

"global": { "cartSync": { "enabled": true, "excludedVariantIds": ["<variant id>"] } }

Use this for a gift your app adds through custom code. A listed product never syncs from or into the app, even when a customer buys it.

Website. Find how your gift app marks its lines: put a gift in the cart, open https://<your-shop>/cart.js, and look at the gift line's properties. Then add this to your theme JavaScript, with that property in place of _gift:

window.AppbrewCartSync = window.AppbrewCartSync || {
  q: [],
  registerSyncFilter: function (h) { this.q.push(h) },
}
AppbrewCartSync.registerSyncFilter({
  excludeLine: function (line) {
    return line.properties['_gift'] === 'true'
  },
})

Matching the marker keeps only the gift out. If a customer buys that same product in the app, it still shows on the website as a paid item.

If your gift does not appear after a change made in the app, add onCartSynced: function () { ... } to the same call and re-run your gift app's check there. It fires each time a cart from the app is applied on the website.

If the gift line has no property, use the first of these that fits:

  • The gift shows at zero price in the cart: return line.price === 0

  • The gift is a product nobody can buy: return line.variantId === '<gift variant id>'

If neither fits, talk to Appbrew before enabling.