normalizeShopifyCart
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
function normalizeShopifyCart(raw: unknown): Cart;Parameters
| Name | Type | Description |
|---|---|---|
raw | unknown |
Returns
Normalised cart, or null when raw is null / undefined.
Related
ShopifyTransport createShopifyCartAdapter MockShopifyTransportOpts mockShopifyTransport
mockShopifyTransport
Builds an inmemory ShopifyTransport that responds with the same envelope shape the real Storefront API would produce. Lets cartcore's contract suite (and host i
ShopifyTransport
Abstraction over the Shopify Storefront GraphQL transport so the adapter stays free of any concrete client (Apollo, fetch, mock). The host wires tenant + locale