---
title: "Add cart"
method: POST
path: "/3.0/ecommerce/stores/{store_id}/carts"
tags: ["ecommerce"]
---

# Add cart

`POST /3.0/ecommerce/stores/{store_id}/carts`

## Request

- Base URL: `https://api.mailchimp.com`
- URL: `https://api.mailchimp.com/3.0/ecommerce/stores/{store_id}/carts`
- Auth: one of:
  - HTTP bearer
  - OAuth 2
    - Authorization code: `https://login.mailchimp.com/oauth2/authorize`
    - Token URL: `https://login.mailchimp.com/oauth2/token`
- TypeScript: <https://skmtc.dev/mailchimp/apis/mailchimp-api/docs/3.0/ecommerce/stores/:store_id/carts/post.ts> (a function with typed inputs; its response is checked against the schema)

Add a new cart to a store.

## Path parameters

- `store_id` string, required

## Request body

- object: Information about a specific cart.
  - `campaign_id` string: A string that uniquely identifies the campaign for a cart.
  - `checkout_url` string: The URL for the cart. This parameter is required for [Abandoned Cart](https://mailchimp.com/help/create-a-classic-abandoned-cart-email/) automations.
  - `currency_code` string, required: The three-letter ISO 4217 code for the currency that the cart uses.
  - `customer` object, required: Information about a specific customer. For existing customers include only the `id` parameter in the `customer` object body.
    - `address` object: The customer's address.
      - `address1` string: The mailing address of the customer.
      - `address2` string: An additional field for the customer's mailing address.
      - `city` string: The city the customer is located in.
      - `country` string: The customer's country.
      - `country_code` string: The two-letter code for the customer's country.
      - `postal_code` string: The customer's postal or zip code.
      - `province` string: The customer's state name or normalized province.
      - `province_code` string: The two-letter code for the customer's province or state.
    - `company` string: The customer's company.
    - `email_address` string: The customer's email address.
    - `first_name` string: The customer's first name.
    - `id` string, required: A unique identifier for the customer. Limited to 50 characters.
    - `last_name` string: The customer's last name.
    - `opt_in_status` boolean: The customer's opt-in status. This value will never overwrite the opt-in status of a pre-existing Mailchimp list member, but will apply to list members that are added through the e-commerce API endpoints. Customers who don't opt in to your Mailchimp list [will be added as `Transactional` members](https://mailchimp.com/developer/marketing/docs/e-commerce/#customers).
  - `lines` object[], required: An array of the cart's line items.
    - `id` string, required: A unique identifier for the cart line item.
    - `price` union, required
      - number
      - string
    - `product_id` string, required: A unique identifier for the product associated with the cart line item.
    - `product_variant_id` string, required: A unique identifier for the product variant associated with the cart line item.
    - `quantity` integer, required: The quantity of a cart line item.
  - `order_total` union, required
    - number
    - string
  - `tax_total` union
    - number
    - string

## Response `200`

- object: Information about a specific cart.
  - `_links` object[]: A list of link types and descriptions for the API schema documents.
    - `href` string: This property contains a fully-qualified URL that can be called to retrieve the linked resource or perform the linked action.
    - `method` 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'OPTIONS' | 'HEAD': The HTTP method that should be used when accessing the URL defined in 'href'.
    - `rel` string: As with an HTML 'rel' attribute, this describes the type of link.
    - `schema` string: For HTTP methods that can receive bodies (POST and PUT), this is a URL representing the schema that the body should conform to.
    - `targetSchema` string: For GETs, this is a URL representing the schema that the response should conform to.
  - `campaign_id` string: A string that uniquely identifies the campaign associated with a cart.
  - `checkout_url` string: The URL for the cart. This parameter is required for [Abandoned Cart](https://mailchimp.com/help/create-a-classic-abandoned-cart-email/) automations.
  - `created_at` string, date-time: The date and time the cart was created in ISO 8601 format.
  - `currency_code` string: The three-letter ISO 4217 code for the currency that the cart uses.
  - `customer` object: Information about a specific customer.
    - `_links` object[]: A list of link types and descriptions for the API schema documents.
      - `href` string: This property contains a fully-qualified URL that can be called to retrieve the linked resource or perform the linked action.
      - `method` 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'OPTIONS' | 'HEAD': The HTTP method that should be used when accessing the URL defined in 'href'.
      - `rel` string: As with an HTML 'rel' attribute, this describes the type of link.
      - `schema` string: For HTTP methods that can receive bodies (POST and PUT), this is a URL representing the schema that the body should conform to.
      - `targetSchema` string: For GETs, this is a URL representing the schema that the response should conform to.
    - `address` object: The customer's address.
      - `address1` string: The mailing address of the customer.
      - `address2` string: An additional field for the customer's mailing address.
      - `city` string: The city the customer is located in.
      - `country` string: The customer's country.
      - `country_code` string: The two-letter code for the customer's country.
      - `postal_code` string: The customer's postal or zip code.
      - `province` string: The customer's state name or normalized province.
      - `province_code` string: The two-letter code for the customer's province or state.
    - `company` string: The customer's company.
    - `created_at` string, date-time: The date and time the customer was created in ISO 8601 format.
    - `email_address` string: The customer's email address.
    - `first_name` string: The customer's first name.
    - `id` string: A unique identifier for the customer.
    - `last_name` string: The customer's last name.
    - `opt_in_status` boolean: The customer's opt-in status. This value will never overwrite the opt-in status of a pre-existing Mailchimp list member, but will apply to list members that are added through the e-commerce API endpoints. Customers who don't opt in to your Mailchimp list [will be added as `Transactional` members](https://mailchimp.com/developer/marketing/docs/e-commerce/#customers).
    - `orders_count` integer: The customer's total order count.
    - `sms_phone_number` string: A US phone number for SMS contact.
    - `total_spent` union
      - number
      - string
    - `updated_at` string, date-time: The date and time the customer was last updated in ISO 8601 format.
  - `id` string: A unique identifier for the cart.
  - `lines` object[]: An array of the cart's line items.
    - `_links` object[]: A list of link types and descriptions for the API schema documents.
      - `href` string: This property contains a fully-qualified URL that can be called to retrieve the linked resource or perform the linked action.
      - `method` 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'OPTIONS' | 'HEAD': The HTTP method that should be used when accessing the URL defined in 'href'.
      - `rel` string: As with an HTML 'rel' attribute, this describes the type of link.
      - `schema` string: For HTTP methods that can receive bodies (POST and PUT), this is a URL representing the schema that the body should conform to.
      - `targetSchema` string: For GETs, this is a URL representing the schema that the response should conform to.
    - `id` string: A unique identifier for the cart line item.
    - `price` number: The price of a cart line item.
    - `product_id` string: A unique identifier for the product associated with the cart line item.
    - `product_title` string: The name of the product for the cart line item.
    - `product_variant_id` string: A unique identifier for the product variant associated with the cart line item.
    - `product_variant_title` string: The name of the product variant for the cart line item.
    - `quantity` integer: The quantity of a cart line item.
  - `order_total` number: The order total for the cart.
  - `tax_total` number: The total tax for the cart.
  - `updated_at` string, date-time: The date and time the cart was last updated in ISO 8601 format.

## Other responses

- `default`: An error generated by the Mailchimp API.

---

[API](https://skmtc.dev/mailchimp/apis/mailchimp-api.md) - [All operations](https://skmtc.dev/mailchimp/apis/mailchimp-api/llms.txt) - [OpenAPI document](https://skmtc.dev/mailchimp/apis/mailchimp-api/revisions/53bf4b156855?raw)
