Variables

CartAddItemsAction

declaration

const CartAddItemsAction: ActionToken<{ input: ZodArray; name: "ecommerce/cart/add-items"; output: ZodVoid; }>

Add items to the cart.

Laioutr supports only one cart per session. Therefore, the items are all added to the same cart.

Also, there is no separate action for creating a cart in laioutr. If the backend-system requires the creation of a cart before items can be added, that must be done in the implementation of this action.

Example

import { CartAddItemsAction } from '@laioutr-core/canonical-types/ecommerce';
fetchAction(CartAddItemsAction, [
  {
    type: 'product',
    productId: '123',
    variantId: '456',
  },
  {
    type: 'discount-code',
    code: '123',
  },
]);

Throws

ProductNotFoundError

Throws

ProductQuantityError

Throws

ProductSoldOutError

Throws

DiscountCodeNotFoundError

Throws

DiscountCodeNotRedeemableError