Cart & Checkout
The cart has two surfaces. Both are Vue components that share one Vuex store (src/vue/store/cart.js) and one line-item component (CartItem).
| Surface | Liquid file | Vue component | Notes |
|---|---|---|---|
| Cart drawer (slide-out) | shopify/sections/layout-header.liquid | StoreCart (src/vue/components/StoreCart/) | Opened from the header basket icon and after every add-to-cart. |
Cart page (/cart) | shopify/sections/main-cart.liquid via templates/cart.json | CartPage (src/vue/components/CartPage/index.vue) | Two-column layout: line items left, upsell + summary right. |
The cart page is Vue, not Liquid
main-cart.liquid only mounts the cart-page Vue component, with the same props as the drawer. There is no server-rendered Liquid cart and no native cart form.
shopify/sections/mini-cart.liquid exists, but its section 'mini-cart' include is commented out in theme.liquid — the drawer is mounted from the header. Don't edit mini-cart.liquid expecting a change.
Pricing model: shipping is added by the theme
Shipping is not a Shopify cart line. The theme adds the flat shipping cost from Theme Settings → PDP Settings → shipping_cost (current value 24.95) to each unit of a one-time line when it shows prices and totals. Subscription lines ship free.
| Shown value | How it's calculated |
|---|---|
| One-time line price | price + shipping_cost |
| Subscription line price | Plan price (final_price), with the one-time price plus shipping struck through next to it |
| Cart subtotal | Sum of line prices × quantity (one-time lines include shipping, subscription lines don't) |
| Struck-through subtotal | (price + shipping_cost) × quantity for every line — shown when it is higher than the subtotal |
The Checkout button links to /checkout. Shopify then charges shipping through the store's shipping rates. The theme's per-unit rule mirrors those rates, so the numbers shown in the cart should match checkout.
One number, three places
shipping_cost feeds the PDP purchase options, the PLP quick-shop popup and both cart views. If the shipping rate in Settings → Shipping and delivery changes, update this setting as well — and the custom.shipping_cost shop metafield used by Checkout Savings.
Theme B: "You save" line (staging only)
On Theme B (branch staging) both cart views show a green "You save $X" line under the subtotal. The saving is the struck-through total minus what the cart charges, so it includes the free shipping on subscription lines and any discount code (the total is read from cart.total_price, which is the only figure that carries a code). Theme A (master) shows only the struck-through subtotal.
Cart drawer
Mounted in: layout-header.liquid (the store-cart component next to the basket icon). Props come from theme settings: shipping, is_first_second_box, timezoneoffset, empty_cart_label, upsale_headline, upsale_headline_best_sellers, upsale_products, anouncements.
Top to bottom:
- Cart announcements — a small auto-rotating slider. Uses the cart settings
announcementLabel/announcementLinkandannouncementLabel2/announcementLink2. When both are empty it falls back to the site Announcement Bar entries. - "Your Cart" + item count, close button.
- Line items (
CartItem, see below). - Empty state — "Looks like your cart is empty!", the
emptyCartLabelcaption and a Shop Now button to/collections/shop-all(the URL is hard-coded). - Upsell — see Upsell products.
- Subtotal (with struck-through full price), discount code field and Checkout button.
The drawer is 100dvh tall with safe-area padding, and it locks page scroll while open (also when it opens straight from the PLP quick-shop popup).
Cart page
Section: main-cart.liquid → cart-page component. Same props as the drawer (shipping, first/second box, empty label, upsell headline and products).
- Left column: line items, or the empty state with Shop Now →
/collections/shop-all. - Right column: upsell carousel ("You might also like") and a bordered summary box with subtotal, discount code and Checkout.
Line items
Component: src/vue/components/CartItem/index.vue
- Title first, then SKU — the product title is the bold link and the SKU / ops subname sits under it in small type.
- Quantity stepper and remove.
- Plan dropdown on subscription lines — lists the product's selling plans (trial products show only the plan part of the title, e.g. "20 bars for 1-week trial, then 60 bars every week"). Switching between plans of the same variant uses
/cart/change.js; switching to a trial (a separate product) removes the line and adds the other variant. - "+ Upgrade To Subscription For Free Shipping" on one-time lines that have a plan available.
- First / Second Box ship-week text on subscription lines when
enable_first_second_boxis on (currently off). - Upsell rows reuse
CartItemwith an add button that shows "adding..." and is disabled while the request runs.
Instant (optimistic) cart updates
Every cart change is drawn on screen immediately and the requests run behind it:
- Adds from the PDP, PLP card / quick-shop popup, related products, cart upsell and header search draw the new row before
/cart/add.jsanswers. Each add site passes an_optimisticpayload (title, variant title, prices in cents, image, handle, SKU) built bysrc/utils/optimistic-line.jsor the Liquid helpersnippets/helper-optimistic-line.liquid. - Stepper taps are accepted while a request is in flight. Requests are chained one at a time (
queueCartMutation), so two updates to the same line can't race. - A new line gets a temporary key (
__opt_…) that is mapped to the real Shopify key once it exists, so the buyer can press + on a line whose add is still running. - Totals are recomputed locally; cart-level discounts from the last server response are kept on top so an applied code doesn't flicker away.
- After an add, the product popup closes and the drawer opens before the cart is refreshed.
If a cart row briefly shows the wrong title or price
The optimistic row is replaced by Shopify's response a moment later. A mismatch means the add site passed a bad _optimistic payload — typically a price that went through the Liquid money filter (a display string, not cents). Fix it at the add site, not in CartItem.
Discount codes
Component: src/vue/components/StoreCart/DiscountCode.vue (used in both cart views).
| Behaviour | Detail |
|---|---|
| Apply | Calls /discount/CODE and refreshes the cart. An applied code shows as a teal pill with an X to remove it (/cart/update.js with an empty discount). |
| Remembered | The code is saved in the browser (localStorage key discountCode) and re-applied whenever the cart total changes, so it survives quantity changes. |
| Invalid code | "The discount code you entered is invalid or cannot be applied to the items in your cart." |
| Gift card | A refused code that looks like a gift card (16 letters/digits) shows a grey note: gift cards are applied at checkout, in the "Discount code or gift card" field. Shopify can't redeem gift cards in the cart. |
Upsell products
Products come from the cart setting upsale (up to 5). Current list: chicken-and-beef, turkey-and-wild-salmon, beef, fish.
- Items already in the cart and unavailable items are left out.
- With items in the cart: headline
upsale_headline("You might also like"), one-slide carousel with arrows. - With an empty cart (drawer only): headline
upsale_headline_best_sellers(schema default "Shop Best Sellers"), shown as a list. - The block is shown whenever the list has products. The
enable_upsalecheckbox is not read by the current code.
Cart settings reference
All in Theme Settings → Cart (t:sections.cart.name):
| Setting | Type | Current value | Used? |
|---|---|---|---|
announcementLabel / announcementLink | text / url | (empty) | Yes — drawer announcement #1 |
announcementLabel2 / announcementLink2 | text / url | (empty) | Yes — drawer announcement #2 |
emptyCartLabel | text | (empty — component default "Add your pet's favorite items to the cart!") | Yes |
upsale_headline | text | "You might also like" (default) | Yes |
upsale_headline_best_sellers | text | "Shop Best Sellers" (default) | Yes — empty drawer |
upsale | product_list | 4 products (see above) | Yes |
enable_upsale | checkbox | default true | No |
free_shipping_amt | number | (not set) | No — there is no free-shipping progress bar |
note_lable / note_placeholder / enable_note | text / text / checkbox | enable_note: false | No — there is no gift-note field |
enable_first_second_box | checkbox | false (default) | Yes — First/Second Box text |
first_box_timezone | text | +12 (default) | Yes |
Orphaned values in settings_data.json
settings_data.json also holds values for empty-cart link settings (emptyCartLink, emptyCartLinkUrl, emptyCartLink1/2, …) and an emptyCart image. These IDs are not in settings_schema.json, and nothing renders them.
Checkout Savings extension
App: Checkout Savings — a checkout UI extension (repo mpp-checkout-savings) that shows subscription buyers what they save at the first checkout step: free shipping per subscription unit plus any subscription-vs-one-time price difference. Its README's worked example is the MPP Fish blend ($194.00, $24.95 shipping per unit).
How the MPP theme relates to it:
| Topic | MPP theme |
|---|---|
_theme_id cart attribute | Not written. Neither master (Theme A) nor staging (Theme B) sets any cart attributes. |
| Extension Theme ID setting | Must stay blank on MPP. A cart without _theme_id never matches a Theme ID filter, so a filled-in value would hide the block on every cart. |
| Shipping rate | The theme reads the theme setting settings.shipping_cost (24.95). The extension reads the shop metafield custom.shipping_cost, then its own shipping_cost block setting. The theme doesn't read the metafield, so keep the two values equal by hand. |
| Cart "You save" line | Theme B only (see above). The extension shows the same kind of saving in checkout, where Shopify otherwise only shows "Free" shipping once an address is entered. |
| Accelerated checkout buttons | The theme renders no Apple Pay / Shop Pay / Google Pay buttons on PDP or cart. |
Whether the block is actually placed in MPP's checkout is managed in Shopify Admin → Settings → Checkout → Customize and isn't visible from the theme repo.
Before switching MPP to a Theme ID filter
The theme would first have to write window.Shopify.theme.id into the _theme_id cart attribute on both Theme A and Theme B (as the Super Snouts theme does in syncThemeAttribute), and the block must stay placed in checkout so it can strip the attribute before the order is created. See Checkout Savings.
Related Vue components
| Component | Role |
|---|---|
StoreCart | Cart drawer — announcements, items, upsell, subtotal, discount code |
StoreCart/DiscountCode.vue | Discount code field and applied-code pill (both cart views) |
CartPage | Full cart page (/cart) |
CartItem | One line item — price, stepper, remove, plan dropdown, upgrade button |
Quantity | Quantity stepper input |
AddToCart | Renderless add-to-cart handler (PDP, PLP, upsell); sends the _optimistic payload |
ProductPopup | PLP quick-shop popup; closes itself when an add hands over to the drawer |