Create or update cart
PUT/api/v1/stores/{store_id}/carts/{cart_id}
Creates the cart with the shop's ID, or updates it. The lines replace the previous ones.
A cart always belongs to a customer, who is created or updated with it. Delete the cart once it has become an order.
Scope
ecommerce:writeEdit e-commerce – the person behind the key must be editor or higher.
Path parameters
store_idstringrequired- The store's ID, which you choose.
cart_idstringrequired- The cart's ID in your shop.
Body
JSON, Content-Type: application/json. Unknown fields return 422.
customerobjectrequired- The customer. Created or updated with the order (same rules as PUT /customers/{customer_id}).
customer.idstringrequired- The customer's ID in your shop.
customer.emailstringrequired- The customer's email address.at most 254 characters
customer.first_namestring | null- First name.at most 100 characters
customer.last_namestring | null- Last name.at most 100 characters
customer.companystring | null- Company.at most 200 characters
campaign_idstring | null- The campaign the customer came from: the value of qn_cid on the link they clicked. Only counts for the workspace's own campaigns; an unknown ID is not saved (but the order is).
checkout_urlstring | null- The URL where the customer can complete the purchase.at most 2048 characters
currencystring- Default: the store's currency.
order_totalnumberrequired- The cart's total amount.at least 0 · at most 999999999999.99
tax_totalnumber | null- Of which VAT.at least 0 · at most 999999999999.99
linesarray<object>required- The cart's lines. Replaces all lines.at most 500
lines[].idstringrequired- The line's ID in your shop.
lines[].product_idstringrequired- The product's ID in your shop.
lines[].variant_idstring | null- The variant's ID in your shop.
lines[].titlestring | null- What was bought, as it appeared on the order.at most 255 characters
lines[].quantityintegerrequired- Quantity.at least 1 · at most 1000000
lines[].pricenumberrequired- Price per unit.at least 0 · at most 999999999999.99
Retrying a request
PUT creates or updates using the shop's own ID: the same call twice gives the same result, so it can always be repeated. Batch and idempotency
Response
200 The cart (201 if it was created).
idstringrequiredcustomerobjectrequiredcustomer.idstringrequiredcustomer.emailstringrequiredcampaign_idstring | nullrequiredcheckout_urlstring | nullrequiredcurrencystringrequiredorder_totalnumberrequiredtax_totalnumber | nullrequiredlinesarray<object>requiredlines[].idstringrequiredlines[].product_idstringrequiredlines[].variant_idstring | nullrequiredlines[].titlestring | nullrequiredlines[].quantityintegerrequiredlines[].pricenumberrequiredcreated_atstring (time, ISO 8601)required- When the cart was first sent in.
updated_atstring (time, ISO 8601)required- When the cart was last changed.
Errors
- 400
- bad_request
- 404
- not_found
- 429
- rate_limited