Skip to content
shopdepot.dev

Reference

cart

The cart.

View as Markdown

Generated from the platform code - always matches what the theme engine allows.

The cart. On the cart page (templates/cart.json) it holds the visitor's cart. Everywhere else it is an empty cart, because pages are cached and shared by every visitor - read the live cart with /cart.js.

Available on: every page (global), cart page.

Properties

Property Type Description
cart.empty boolean True when the cart has no items.
cart.itemCount number Number of units in the cart (the sum of quantities).
cart.items list of cart_line The lines of the cart.
cart.subtotal number Value of the items before order-level discounts and shipping, in minor units.
cart.discountTotal number Sum of all discounts, in minor units.
cart.shippingTotal number Shipping cost known on the cart page, in minor units. The customer picks the method in checkout.
cart.taxTotal number VAT included in the total (items and shipping), in minor units - for "including X tax".
cart.totalPrice number What the customer pays, in minor units.
cart.currency string or null ISO 4217 code of the cart currency.
cart.note string or null Always empty - the customer writes the order note in checkout. Kept so templates written for Shopify keep working.
cart.discountCode string or null The first discount code the customer entered, if any. A cart can hold several - see discountCodes.
cart.discountCodes list Every discount code in the cart, in the order they were added: a list of { code, applied, error }. applied is true when the code gives a discount; otherwise error says why (threshold not met, does not combine with another code).
cart.discountCodeError string or null Why the entered code does not apply - show it next to the coupon field.
cart.discounts list Applied promotions: a list of { label, code, amount, kind }, where kind is product, order or shipping.
cart.notices list Threshold hints from automatic promotions: a list of { label, missing, unit }; unit is amount (minor units) or items (pieces) - "Add 45 PLN more to get free delivery".
cart.freeShippingMissing number or null How much is missing to free delivery, in minor units. Null when the store has no free delivery threshold.
cart.shippingFrom number or null The cheapest delivery for this cart, computed from the store's delivery methods exactly as checkout does, in minor units. Null when no method fits. Write "Delivery from X" from this value, never from a theme setting.