# Research: E-Commerce Shareable Cart Links

**Date:** 2026-04-03
**Goal:** How can an AI assistant build a cart and send a clickable link to a human for review and payment?

---

## 1. Shopify Cart Permalinks (BEST APPROACH)

### Exact URL Format

```
https://{store}.myshopify.com/cart/{variant_id}:{quantity}
```

**Single item:**
```
https://my-shop.myshopify.com/cart/36485954240671:1
```

**Multiple items (comma-separated):**
```
https://my-shop.myshopify.com/cart/36485954240671:3,31384149360662:1
```

### Query Parameters

| Parameter | Purpose | Example |
|-----------|---------|---------|
| `discount` | Apply discount code(s) | `?discount=SAVE10` |
| `discount` (multiple) | Comma-separated codes | `?discount=CODE1,CODE2` |
| `storefront` | Redirect to cart page (not checkout) | `?storefront=true` |
| `payment` | Direct to Shop Pay | `?payment=shop_pay` |
| `checkout[email]` | Pre-fill email | `?checkout[email]=user@example.com` |
| `checkout[shipping_address][*]` | Pre-fill address fields | `?checkout[shipping_address][city]=Bangalore` |
| `note` | Order note (conversion tracking) | `?note=annie-order` |
| `attributes[key]` | Key-value metadata | `?attributes[from]=annie` |
| `ref` | Referral code | `?ref=ai-assistant` |
| `access_token` | Storefront token (sales attribution) | `?access_token=TOKEN` |
| `properties` | Line item properties (Base64 JSON, first item only, max 25) | `?properties=eyJ...` |

### Full example — Annie builds a TWF flour order:

```
https://thewholetruthfoods.com/cart/VARIANT_1:2,VARIANT_2:1?discount=WELCOME10&storefront=true&attributes[ordered_by]=annie
```

### Key Behaviors

- **Clears existing cart:** Cart permalinks REPLACE the entire cart. They do NOT append to an existing cart. This is actually good for the AI use case — the link represents exactly what Annie built.
- **No login required:** Works for guest checkout. Creates a fresh checkout session.
- **Reusable:** Same link creates a new checkout for each visitor.
- **Locale support:** `/fr/cart/...` for localized checkout.
- **Default destination:** Without `?storefront=true`, the link goes straight to checkout. WITH it, it goes to the cart page where the human can review/modify.

### Limitations

- **No selling plans** (subscriptions) via cart permalinks.
- **Cannot bypass storefront passwords** (password-protected stores).
- **Discount codes with commas** don't work (e.g., `savings, today!` breaks the parser).
- **No explicit max items** documented, but URL length is practically limited. Shopify shop URLs max at 255 chars for the path, but the full URL with query params can be longer. Browser limit is ~2,048 chars (IE) to ~8,192 chars (modern). With ~15-digit variant IDs, roughly **50-100 items** fit comfortably.
- **Line item properties** only apply to the first item in the permalink.
- **Variant IDs required** (not product IDs). Each size/color/option has a separate variant ID.

### How to Find Variant IDs

1. **Admin URL:** `https://admin.shopify.com/store/{name}/products/{pid}/variants/{variant_id}`
2. **Product JSON:** `https://{store}.myshopify.com/products/{handle}.json` — look in `product.variants[].id`
3. **Storefront URL:** Select variant on product page, URL shows `?variant={id}`
4. **Admin XML:** `https://{store}.myshopify.com/admin/products/{pid}.xml`
5. **Storefront API:** GraphQL query for product variants

**For programmatic use (Annie), method 2 (product JSON) is ideal — no auth required, returns all variant IDs with titles/prices.**

### Confidence: HIGH

This is a native, documented, stable Shopify feature. It's been available for years and is the standard approach for email marketing, social media, and affiliate links. Perfect for the "AI builds cart, human clicks to pay" flow.

---

## 2. Shopify AJAX Cart API (`/cart/add.js`)

### Endpoints

| Endpoint | Method | Purpose |
|----------|--------|---------|
| `/cart/add.js` | POST | Add items to cart |
| `/cart/update.js` | POST | Update quantities |
| `/cart/change.js` | POST | Change a single item |
| `/cart/clear.js` | POST | Clear entire cart |
| `/cart.js` | GET | Get cart contents |

### CORS and External Access

- **CORS blocked:** These endpoints do NOT support cross-origin requests. Calling from a different domain fails silently (cart remains empty) or throws CORS errors.
- **No auth required:** The API is unauthenticated — no access tokens or client IDs needed.
- **Session-bound:** Cart state is tied to browser cookies. You cannot create a cart server-side and transfer the session.
- **Shopify-hosted only:** Officially, "you can't use the Ajax API on a Shopify custom storefront."
- **JSONP is GET-only:** Some suggest JSONP as a workaround, but POST operations (add/update) don't work with JSONP.

### Could We Build Server-Side and Share Session?

**No.** The cart is bound to browser session cookies (`_shopify_s`, `_shopify_y`, `cart` cookies). There is no mechanism to:
1. Create a server-side session
2. Extract the session cookie
3. Transfer it to a user's browser

Even if you managed to set cookies, Shopify's anti-fraud systems would likely flag cross-IP session reuse.

### Verdict: NOT VIABLE for the AI assistant use case.

Cart permalinks are strictly superior — they achieve the same result (pre-filled cart) without any CORS, session, or authentication complexity.

---

## 3. Shopify Storefront API (GraphQL) — Alternative Programmatic Approach

### How It Works

1. Create a Storefront API access token (one-time setup via Shopify admin or `storefrontAccessTokenCreate` mutation)
2. Call `cartCreate` mutation with line items
3. Query `checkoutUrl` from the created cart
4. Send `checkoutUrl` to the human

### GraphQL Example

```graphql
mutation {
  cartCreate(input: {
    lines: [
      { quantity: 2, merchandiseId: "gid://shopify/ProductVariant/36485954240671" },
      { quantity: 1, merchandiseId: "gid://shopify/ProductVariant/31384149360662" }
    ]
  }) {
    cart {
      id
      checkoutUrl
    }
  }
}
```

### Pros vs Cart Permalinks

- **Programmatic:** Full API, no URL string construction
- **Discount codes:** Can apply via `cartDiscountCodesUpdate` mutation
- **Buyer identity:** Can pre-fill email, address, phone via `cartBuyerIdentityUpdate`
- **Richer data:** Returns prices, availability before sending link
- **No URL length limit:** Cart state lives server-side

### Cons vs Cart Permalinks

- **Requires Storefront Access Token:** Must be created by the store owner (one-time, but requires admin access)
- **Security concern:** Cart ID contains a secret key (`?key=...`). Shopify warns: "Never expose the secret part of the ID in shareable links."
- **checkoutUrl shareability is unclear:** Shopify docs warn the URL may be "stale" and suggest re-requesting it. Some merchants report the URL redirects to login when guest checkout is disabled.
- **More complex:** Requires GraphQL client, token management, error handling
- **Store-specific:** Each store needs its own token

### Verdict: VIABLE but overkill for most cases.

Use this when you need to validate stock/prices before building the link, or when the cart has too many items for a URL. For simple "build and share" flows, cart permalinks are simpler and more reliable.

---

## 4. Other Platforms

### WooCommerce (WordPress)

**Two built-in approaches:**

#### A. Add-to-Cart URL (legacy, all versions)
```
https://store.com/?add-to-cart=PRODUCT_ID&quantity=2
```
- Single product only per URL
- Appends to existing cart (does NOT clear)
- Redirect to checkout: `https://store.com/checkout/?add-to-cart=123&quantity=2`
- Variable products use variation ID
- No coupon support in URL

#### B. Shareable Checkout URLs (WooCommerce 10+, mid-2025)
```
https://store.com/checkout-link/?products=123:2,456:1&coupon=SUMMER25
```
- **Multiple products** with quantities (comma-separated, `ID:QTY`)
- **Coupon support** via `&coupon=CODE`
- **No login required** — works for guests via temporary session tokens
- **Session persistence** across devices
- **Error handling** — gracefully reports invalid products/coupons
- **Directly to checkout** (not cart page)

**WooCommerce 10 shareable checkout URLs are the closest equivalent to Shopify cart permalinks.** Very similar format and behavior.

### BigCommerce

```
https://store.com/cart.php?action=add&product_id=123
```

- `action=add` — adds to cart page
- `action=buy` — adds and goes to checkout
- **Single product only** per URL (first value of comma-separated list)
- **No multi-product support** natively
- **No coupon parameter**
- Products with variations: limited support

**Verdict:** Weak. Single-product only. Not suitable for multi-item cart building.

### Magento / Adobe Commerce

- **No native shareable cart URL feature**
- Requires third-party extensions:
  - [Save Cart & Share Cart](https://commercemarketplace.adobe.com/fme-share-cart.html)
  - [Direct Product Add](https://commercemarketplace.adobe.com/sukhvir-directproductadd.html)
  - [Share Shopping Cart (Webkul)](https://commercemarketplace.adobe.com/webkul-magento2-share-and-multicart.html)
- Extensions generate shareable links with cart contents
- No standardized URL format across stores

**Verdict:** Extension-dependent. No universal approach.

---

## 5. Third-Party Cart Sharing Services

### Share-A-Cart

- **Website:** [share-a-cart.com](https://share-a-cart.com/)
- **How:** Browser extension + website. User clicks "Create Cart ID" to get a shareable code.
- **Supported stores:** Amazon, Walmart, BestBuy, IKEA, Instacart, Kroger, Shopify stores, and many more
- **Limitations:**
  - Single-retailer carts only
  - Lists expire after 6 months of inactivity
  - Regional restrictions (US list won't load on UK site)
  - Out-of-stock items don't transfer
- **No public API** — requires browser extension interaction
- **Revenue model:** Affiliate commissions from retailers

### Shopping Cart Share (Chrome Extension)

- Builds unified carts from multiple retailers
- Generates shareable link
- Browser extension only

### Verdict: NOT VIABLE for AI assistant.

These services require browser extension interaction. No programmatic API. Cannot be called from a server-side AI agent.

---

## 6. Deep Linking to Product Pages

### Shopify

```
https://store.com/products/product-handle?variant=36485954240671
```

- Pre-selects the variant on the product page
- **No quantity parameter** on the product page URL
- Customer still has to click "Add to Cart" manually

### WooCommerce

```
https://store.com/product/product-name/?attribute_pa_color=red&attribute_pa_size=large
```

- Pre-selects variation attributes
- Customer still has to click "Add to Cart"

### Verdict: NOT USEFUL for the AI cart-building use case.

Deep links to product pages require the human to manually add each item. Defeats the purpose of AI building the cart.

---

## Recommendation: Best Approach for Annie

### Primary: Shopify Cart Permalinks

For Shopify stores (like TWF), cart permalinks are the clear winner:

```
https://{store}/cart/{variant1}:{qty1},{variant2}:{qty2}?storefront=true&discount=CODE
```

**Annie's workflow:**
1. Annie looks up products via store's `/products.json` or `/products/{handle}.json` (no auth)
2. Annie identifies variant IDs for the right sizes/options
3. Annie constructs cart permalink URL
4. Annie sends URL to Rajesh via Telegram: "I've put together your TWF order -- 2x Peanut Butter (crunchy), 1x Almond Butter. [Review & Pay](url)"
5. Rajesh clicks link, reviews cart on store, pays with saved payment method

**Why `?storefront=true`:**
- Sends Rajesh to the CART page, not directly to checkout
- Rajesh can review, adjust quantities, remove items
- Then proceeds to checkout when ready

**Why not direct checkout (without `?storefront=true`):**
- For trusted, well-known orders, skip the cart and go straight to checkout
- Annie could ask: "Want to review first, or go straight to checkout?"

### Fallback: Storefront API (for complex cases)

Use the Storefront API `cartCreate` + `checkoutUrl` when:
- Cart has 50+ items (URL length concern)
- Need to validate stock/prices before sending link
- Need to apply complex discount logic
- Store has custom checkout requirements

### For WooCommerce Stores

Use the native shareable checkout URLs:
```
https://store.com/checkout-link/?products=ID:QTY,ID:QTY&coupon=CODE
```

### For Other Platforms

Fall back to single-product add-to-cart URLs chained together, or use ADB automation as already implemented.

---

## Summary Table

| Platform | Multi-Item Cart Link | Discount | No Login | Clears Cart | Confidence |
|----------|---------------------|----------|----------|-------------|------------|
| **Shopify (permalink)** | YES (`id:qty,id:qty`) | YES (`?discount=`) | YES | YES (replaces) | HIGH |
| **Shopify (Storefront API)** | YES (GraphQL) | YES (mutation) | YES* | N/A (new cart) | HIGH |
| **WooCommerce 10+** | YES (`products=id:qty`) | YES (`&coupon=`) | YES | YES (new session) | HIGH |
| **WooCommerce (legacy)** | NO (single product) | NO | YES | NO (appends) | HIGH |
| **BigCommerce** | NO (single product) | NO | YES | Appends | MEDIUM |
| **Magento** | Extension-dependent | Extension-dependent | Varies | Varies | LOW |
| **Share-A-Cart** | YES | NO | YES | YES | LOW (no API) |

*Shopify Storefront API requires guest checkout to be enabled on the store.

---

## Sources

- [Shopify Help Center: Cart Permalinks](https://help.shopify.com/en/manual/checkout-settings/cart-permalink)
- [Shopify Dev: Create Cart Permalinks](https://shopify.dev/docs/apps/build/checkout/create-cart-permalinks)
- [Shopify Dev: Ajax API](https://shopify.dev/docs/api/ajax)
- [Shopify Dev: Storefront API Cart Management](https://shopify.dev/docs/storefronts/headless/building-with-the-storefront-api/cart/manage)
- [Shopify Dev: Storefront API Cart Object](https://shopify.dev/docs/api/storefront/latest/objects/Cart)
- [Shopify Community: Cart Permalink Clears Existing Cart](https://community.shopify.com/t/how-can-i-create-a-cart-permalink-that-retains-existing-selections/236140)
- [Shopify Community: CORS on Ajax API](https://community.shopify.com/c/shopify-apis-and-sdks/blocked-by-cors-policy-on-ajax/td-p/1140706)
- [Shopify Community: Ajax API from External Domain](https://community.shopify.com/c/shopify-apis-and-sdks/ajax-cart-api-from-external-domain/td-p/1540479)
- [Shopify Help Center: Find a Variant ID](https://help.shopify.com/en/manual/products/variants/find-variant-id)
- [Shopify Dev: Storefront API Authentication](https://shopify.dev/docs/api/usage/authentication)
- [GitHub: Storefront API checkoutUrl Discussion](https://github.com/Shopify/storefront-api-feedback/discussions/197)
- [WooCommerce: Creating Shareable Checkout URLs](https://woocommerce.com/document/creating-sharable-checkout-urls-in-woocommerce/)
- [WooCommerce: Shareable Checkout URLs (Developer Docs)](https://developer.woocommerce.com/docs/best-practices/urls-and-routing/checkout-urls/)
- [WooCommerce 10 Shareable Checkout URLs Guide](https://www.remicorson.com/articles/2025/06/woocommerce-10-shareable-checkout-urls-complete-guide)
- [WooCommerce: Add-to-Cart URLs](https://woocommerce.com/document/quick-guide-to-woocommerce-add-to-cart-urls/)
- [BigCommerce: Add to Cart URLs](https://developer.bigcommerce.com/docs/storefront/cart-checkout/guide/add-to-cart-urls)
- [BigCommerce Support: Custom Add to Cart Links](https://support.bigcommerce.com/s/article/How-can-I-add-a-product-to-the-cart-with-a-link?language=en_US)
- [Share-A-Cart FAQ](https://share-a-cart.com/faq)
- [Share-A-Cart Home](https://share-a-cart.com/)
- [Elevar: Auto-Add Products & Discount to Shopify Cart via URL](https://getelevar.com/shopify/how-to-auto-add-product-to-shopify-cart/)
- [Rob Johnson: Multi-Product Add-to-Cart Permalinks](https://www.robkjohnson.com/posts/shopify-add-multple-items-to-cart-with-one-link/)
- [DevCommerce: Shopify Cart Permalinks Guide](https://devcommerce-agency.com/blog/shopify-cart-permalinks)
