createEmptyCart
Create an empty cart.
Signature
declare function createEmptyCart(
context: Context,
customHeaders?: CustomHeaders
): Promise<FetchResult<CreateEmptyCartMutation>>;Parameters
| Name | Required | Type | Description |
|---|---|---|---|
context | Required | Context | |
customHeaders | Optional | CustomHeaders |
Referenced Types
- Context
- CustomHeaders
FetchResultCreateEmptyCartMutation
Examples
Simple usage:
import { sdk } from '~/sdk.config.ts';
// create an empty cart
const cart = await sdk.magento.createEmptyCart();
// cart id can be accessed from the response
const cartId = cart.data.createEmptyCart;