getCart() returns, what cart_loaded and cart_updated hand your handler, and what a Custom code block receives.
All money is in the currency’s minor unit (cents for USD), never a formatted string.
5779 is $57.79. Use formatMoney to display it.The cart
Cart lines
Each entry initems, and the item on item_added and item_removed:
Identifying a line
Usekey for anything that acts on a line, and variantId or productId for anything that identifies a product:
variantId. That’s why the actions take key.
Prices on a line
Three prices, easy to mix up:Bundles
When lines are grouped into a bundle, the anchor line carries abundle object. The children are folded into it and no longer appear in items on their own. See Group bundle lines from another app for how grouping is set up.
Each child carries
key (null for a native component), title, variantTitle, quantity, perAnchorQty, imageUrl, finalLinePrice, originalLinePrice, and compareAtPrice.
Subscription plans
A line’s active plan issellingPlan, or null for a one-time purchase. For a whole-cart answer, read hasSubscriptionItems rather than scanning the lines yourself, since it also counts add-on lines that items presents but itemCount skips:
registerSubscriptionOptionsTransform and registerDefaultSubscriptionOptionSelector.