Skip to main content

Create a Cart

POST 

/v2/carts

Creates a cart. Call this endpoint each time a customer creates a cart.

Each shopper can have multiple carts. Use the carts API to create a cart. The carts are distinct from one another. Shoppers can add different items to their carts. They can check out one of the carts without affecting the content or status of their other carts.

After the shopper checks out the cart, the cart remains available to the shopper. The cart is persistent and stays with the shopper after it is used.

You can also create a cart to specify custom discounts. You can enable custom discounts when the discount_settings.custom_discounts_enabled field is set to true. Default is set from cart discount settings for the store. See Update Cart Settings.

Preview Cart

You can set a future date for your shopping cart and view the promotions that will be available during that time period. This feature enables you to validate your promotion settings and observe how they will be applied in the cart.

caution
  • Once the cart is in preview mode, you cannot revert it to a regular cart.
  • Carts with snapshot_date are same as preview carts.
  • You cannot checkout a cart that includes a snapshot_date.
  • To delete a promotion preview cart, use Delete a cart endpoint.
  • The promotion preview cart has the same expiration time as a regular cart based on the store's cart settings.
  • Preview cart interactions skip inventory checks and events, allowing users to preview future carts without impacting related external systems.

Errors

  • 400 Bad Request : This is returned when the submitted request does not adhere to the expected API contract for the endpoint.

    • For example, in the case of string fields, this error might indicate issues in the length or format of submitted strings. For more information about valid string fields, refer to Safe Characters section.
    • In the case of preview carts (those with snapshot_date), an error is returned for invalid actions, such as removing the preview date, setting a preview date in the past, or attempting to checkout a cart with a snapshot_date.

Request

Responses

Response Headers