Using your own cart
For a theme cart, a custom cart or a headless storefront: what Luxe does without its drawer, set and gift lines, rewards, members and the events to use.
Theme cart or Luxe cart
Luxe works with the theme's own cart (the default) or replaces it with the Luxe cart drawer, a merchant setting in the app (The Luxe cart). Checkout is the same in both: set prices and ladder rewards come from Shopify Functions, whatever renders the cart.
| Theme cart (default) | Luxe cart drawer | |
|---|---|---|
| Set prices and rewards at checkout | Yes | Yes |
| Ladder progress and gift choice | Where the merchant places the Rewards bar block (Full layout for gift choice) | Built in |
| Edit set | Added by Luxe on the theme's cart page, with no code | Built in |
| Gift removed when its rung is lost | Only where a Rewards bar is on the page | Always |
window.Luxe.cart | undefined | register, hideLines, refresh |
luxe:* DOM events | Yes, except the drawer's own | Yes |
So with a theme cart, check window.Luxe?.cart before calling it, and use the DOM events instead: they fire in both modes.
What the cart holds
Everything Luxe adds is an ordinary Shopify cart line with _luxe_* line properties, which themes hide because they start with _ (Line properties).
| Line | In /cart.js |
|---|---|
| Build-your-own or Fixed set | One line for the set product, with _luxe_kit (and _luxe_slots for a Build-your-own set). After the Cart Transform, Liquid lists its components in item.item_components; the visible Includes property lists the picks |
| Collection set | One line per item, all sharing one _luxe_kit_group value |
| A set bought on subscription | One line per item on its selling plan, sharing one _luxe_kit_group value (Subscription sets) |
| Reward gift | A line with _luxe_gift |
| Upsell or checkout offer | Lines with _luxe_addon |
- Prices are Shopify's. Line prices, discount allocations and totals in
/cart.jscome after the Cart Transform and the Discount Function ran. Luxe's builder, tray and bar predict; only the Functions change prices. Show Shopify's numbers. - Never edit
_luxe_*values. The Functions never trust a property for price and re-validate every set; an invalid build sells unexpanded at the set product's own price. - Treat a
_luxe_kit_groupas one set when you show, change or remove its lines. - Set contents and Edit set in a custom line-item loop: Theme code recipes.
Rewards and gifts
- Money and free shipping rungs need no cart code: the Luxe Rewards discount applies them. A money reward shows in Shopify's cart as a discount allocation; free shipping applies at checkout.
- Progress and gift choice come from the Rewards bar theme app block. On the cart page the merchant adds it in the theme editor; in a theme's own drawer, where app blocks cannot go, use the Rewards bar recipe.
- Gifts are never added without the shopper's tap. A chosen gift is a line with
_luxe_gift, free only while its rung holds. A Rewards bar on the page removes it when the rung is lost; without one, checkout charges it at its own price. - Members' teaser. Placed By the checkout button, it appears under the theme's checkout button on the cart page, and in a theme drawer that shows the Rewards bar.
Keeping the cart in step
| Need | Use |
|---|---|
| Re-render the theme cart after Luxe changes it | luxe:cart:updated ({ itemCount, totalPrice, lines }), after every cart read Luxe makes |
Open the theme's drawer instead of going to /cart after a set is added | Call preventDefault() on luxe:kit:added |
Tell Luxe the cart changed outside /cart/*.js (the Storefront API, for example) | Dispatch luxe:cart:request-refresh on document. Changes through /cart/add.js, /cart/change.js, /cart/update.js and /cart/clear.js are noticed on their own |
A complete script for Dawn, Horizon and two premium theme families, with loop protection: Keep a theme cart in step.
Members
Member prices need no cart code either: for a signed-in member, Shopify's cart already carries them. No line property, luxe:* event or window.Luxe.cart member says a line is member-priced. Details: Members and member pricing.
Headless and mobile
A storefront without the theme has no app embed, so no Luxe component, DOM event or customer event runs there:
- Read live sets and the published ladder from the bundle set endpoint, and predict prices from it, as the Tapcart blocks do.
- Add sets with the same
_luxe_*line properties as the theme (Line properties). The Functions price and re-validate every build at checkout, so a client needs no signature. - A headless cart reads no customer for Luxe, so show the public ladder and guest prices; checkout gives members more, never less.