Shopify just rolled out a subtle but powerful change to the Checkout Functions API. The cart.deliverableLine input now models a cost object and includes a direct reference to its originating cart.line. For developers who build custom checkout experiences, this adds richer pricing data and a clearer linkage between the cart and the checkout stage. In this post we’ll unpack the change, identify who needs to act, and walk through the exact code adjustments you should make today.
What Changed
Previously, cart.deliverableLine exposed only a handful of properties such as quantity, title, and price. The new schema introduces a cost field that mirrors the structure used throughout Shopify’s cart and order APIs (including amount, currencyCode, and tax). Additionally, each deliverableLine now carries a cartLine object that points back to the exact cart.line that generated it. This bidirectional link eliminates the guesswork developers faced when trying to reconcile checkout‑time adjustments with the original cart items.
Who Is Affected
The update primarily targets developers who have authored or are maintaining Checkout Functions—especially those that rely on cart.deliverableLine for pricing logic, discounts, or fulfillment rules. Merchants who simply use Shopify’s out‑of‑the‑box checkout won’t see a visual change, but they benefit indirectly because developers can now build more accurate and transparent cost calculations. If you’ve ever written custom logic that iterates over cart.deliverableLine without a direct reference to the source cart line, your code may now need a small refactor to avoid undefined errors.
How To Update Your Checkout Functions
Below is a minimal example that shows the new structure in action. The snippet pulls the cost object, formats it for display, and uses the cartLine.id to correlate any downstream operations (such as custom fulfillment services).
js
export default function Checkout(context) {
const { cart } = context;
// Map over the updated deliverableLine array
const deliverableLines = cart.deliverableLine.map(dl => ({
// New cost model (amount in minor units, currency code, tax information)
cost: dl.cost, // { amount: 1299, currencyCode: 'USD', tax: { amount: 0, included: false } }
// Direct link back to the original cart line
cartLineId: dl.cartLine.id,
// Preserve any existing data you still need
quantity: dl.quantity,
title: dl.title,
}));
// Example: log each line for debugging
deliverableLines.forEach(line => {
console.log(Line ${line.cartLineId} costs ${line.cost.amount / 100} ${line.cost.currencyCode});
});
// Return the unmodified cart if you don’t need further changes
return { cart };
}
Testing & Validation
After updating your function, run it in the Checkout Extensibility dev environment. Verify that the cost object reflects the correct amount (Shopify still uses minor units) and that cartLine.id matches an entry in cart.line. Use the GraphQL Explorer or the Checkout UI Extensions Playground to fetch a sample checkout and inspect the payload. If you see undefined for dl.cartLine, double‑check that you’re on a store version that has the new schema—Shopify rolls it out gradually, so a fallback check (if (dl.cartLine)) is a safe guard.
Practical Takeaways
cost field the same way you treat cart.cost elsewhere; it provides amount, currency, and tax details in a single object.dl.cartLine.id whenever you need to update inventory, apply discounts, or send data to a third‑party fulfillment service.dl.cartLine ?? {}).cart.deliverableLine.Conclusion
The new cost model and cart‑line linkage turn cart.deliverableLine into a first‑class source of truth for checkout pricing. By updating your Checkout Functions now, you’ll avoid runtime errors, unlock more precise cost calculations, and lay the groundwork for future enhancements such as tax‑aware discounts or multi‑currency support. Need help migrating your codebase? Reach out to the Shopify Partner community or drop a comment below—we’re happy to troubleshoot together!
