normalizeShopifyCart

cart · /shopify·function

Normalises a raw Shopify Storefront Cart payload into cart-core's provider-agnostic Cart. Returns null for falsy input so callers can use the same function for both cart query results and post-mutation envelopes.

Shopify's deprecated totalTaxAmount / totalDutyAmount fields are mapped to null because cart-core treats taxes + shipping as host-computed. Buyer-identity provider data (e.g. customer access tokens) is intentionally dropped: the new BuyerIdentity.provider shape is supplied by the host auth bridge, not echoed back from Shopify.

Signature

@nordcom/commerce-cart
function normalizeShopifyCart(raw: unknown): Cart;

Parameters

NameTypeDescription
rawunknown

Returns

Normalised cart, or null when raw is null / undefined.

ShopifyTransport createShopifyCartAdapter MockShopifyTransportOpts mockShopifyTransport

On this page