Skip to content

Cart

How EdgeCart holds line items, calculates totals, and applies plugin adjustments before checkout.

The Cart module represents a shopper’s intent to buy before an order exists. It collects line items, keeps the customer and region context, and calculates the totals shown at checkout.

Features

  • Cart lifecycle — create, retrieve, update, and complete a cart.
  • Line items — add a variant with a quantity and keep a snapshot of its price.
  • Totals — subtotal, discount, tax, shipping, and grand total in minor units.
  • Adjustments — promotion discounts and plugin-proposed adjustments applied to lines or the cart.
  • Cart context — the region, customer, and sales channel that determine pricing, tax, and availability.

Key concepts

Concept What it means
Cart A pending purchase with line items and totals.
Line item One variant in the cart, with a quantity and a snapshotted unit price.
Adjustment A discount or surcharge attached to a line item, shipping, or the cart.
Totals The calculated subtotal, discount, tax, shipping, and grand total.
Cart context The region, customer, and sales channel used to resolve prices and taxes.

How it fits

  • Storefront — the shop keeps the guest cart in sessionStorage and syncs it through the Store API. Signed-in customers have a server-backed cart.
  • Catalog — supplies the variant price and inventory when a line is added or updated.
  • Sales — supplies the region, customer group, promotions, and tax context.
  • Payments — a payment collection and session are created for the cart at checkout.
  • Orders — completing a paid cart creates the order.
  • Plugins — plugins can propose cart adjustments through hooks; the host recalculates totals rather than trusting plugin arithmetic.

Common tasks

  • Merchant — the cart is the shopper’s view of your catalog. See the merchant guide for product and store setup.
  • Developer — use the Store API operations in the API reference, and read API conventions for money and idempotency.
  • Catalog — product prices and inventory.
  • Sales — regions, customers, promotions, and tax.
  • Orders — checkout creates an order.
  • Payments — payment sessions for the cart.

Type to search…

↑↓ navigate↵ selectEsc close