CartAdapter

cart · /core·interface

Contract that every cart provider implementation satisfies. Adapters expose required CRUD operations and declare their optional capabilities so the kernel can gate advanced mutations without probing method presence.

Properties

capabilities
type
string
addLines
unknown
createCart
unknown
getCart
unknown

Example

class ShopifyAdapter implements CartAdapter {
  readonly type = 'shopify';
  readonly capabilities: CartCapabilities = {
    giftCards: true, multipleDiscountCodes: true,
    buyerIdentity: true, notes: true, cartAttributes: true,
    lineAttributes: true, customMutations: [],
  };
  async getCart(ctx, { cartId }) { ... }
  async createCart(ctx, args) { ... }
  async addLines(ctx, args) { ... }
  async updateLines(ctx, args) { ... }
  async removeLines(ctx, args) { ... }
}

RunCartAdapterContractOpts runCartAdapterContract CartCapabilityUnsupportedError CartError CartNotFoundError CartProviderError CartUserError CartEventBus

Sourceadapter.ts:70Edit the JSDoc directly

On this page