MutationFn

cart · /core·type

Core mutation primitive: an async function that accepts a and its dispatch context, and returns the resulting cart snapshot.

Definition

@nordcom/commerce-cart
type MutationFn = (mutation: CartMutation, ctx: AdapterCtx) => Promise<Cart>;

(mutation: CartMutation, ctx: AdapterCtx) => Promise<Cart>

Example

const terminal: MutationFn = async (mutation, ctx) =>
  adapter.addLines(ctx, { cartId: ctx.cartId ?? '', lines: [] });

RunCartAdapterContractOpts runCartAdapterContract CartCapabilityUnsupportedError CartError CartNotFoundError CartProviderError CartUserError CartAdapter

Sourcecompose.ts:13Edit the JSDoc directly

On this page