POST

Add To Cart


Adds catalog line items to a cart.

Note: When adding catalog line items to your cart, the lineItems.catalogReference.appId and lineItems.catalogReference.catalogItemId fields are required.

Permissions
Manage eCommerce - all permissions
Manage Stores - all permissions
Manage Restaurants - all permissions
Manage eCommerce - Admin Permissions
Learn more about app permissions.
Endpoint
POST
https://www.wixapis.com/ecom/v1/carts/{id}/add-to-cart

Path Params
idstringRequired

Cart ID.

Body Params
lineItemsArray <LineItem>maxItems 100

Catalog line items.


customLineItemsArray <CustomLineItem>betamaxItems 100

Custom line items. Custom line items don't trigger the Catalog service plugin.

To access and manage custom line items, your app must have the permission scope named "Manage eCommerce - Admin Permissions". Learn more about permission scopes.

Response Object
cartCart

Updated cart.

Request
cURL
curl -X POST \ 'https://www.wixapis.com/ecom/v1/carts/f97a2939-b1f3-41f2-9fc5-7ecea2060991/add-to-cart' \ -H 'Authorization: <AUTH>' -H 'Content-Type: application/json' \ --data-binary '{ "lineItems": [{ "catalogReference": { "appId": "215238eb-22a5-4c36-9e7b-e7c08025e04e", "catalogItemId": "a667539v45-9v22-b343-bbf4-eee54be85634f" }, "quantity": 7 }] }'
Response
JSON
{ "cart": { "id": "f97a2939-b1f3-41f2-9fc5-7ecea2060991", "lineItems": [ { "id": "00000000-0000-0000-0000-000000000001", "quantity": 3, "catalogReference": { "catalogItemId": "c8539b66-7a44-fe18-affc-afec4be8562a", "appId": "215238eb-22a5-4c36-9e7b-e7c08025e04e" }, "productName": { "original": "Shirt", "translated": "Shirt" }, "url": { "relativePath": "/product-page/shirt", "url": "https://example.wixsite.com/my-site/product-page/shirt" }, "price": { "amount": "10", "convertedAmount": "10", "formattedAmount": "$10.00", "formattedConvertedAmount": "$10.00" }, "fullPrice": { "amount": "10", "convertedAmount": "10", "formattedAmount": "$10.00", "formattedConvertedAmount": "$10.00" }, "priceBeforeDiscounts": { "amount": "10", "convertedAmount": "10", "formattedAmount": "$10.00", "formattedConvertedAmount": "$10.00" }, "descriptionLines": [], "image": { "id": "3c76e2_c5331f937348492a97df87b0a3b34ea4~mv2.jpg", "url": "https://static.wixstatic.com/media/3c76e2_c5331f937348492a97df87b0a3b34ea4~mv2.jpg", "height": 1000, "width": 1000 }, "availability": { "status": "AVAILABLE" }, "physicalProperties": { "sku": "364115376135191", "shippable": true }, "couponScopes": [ { "namespace": "stores", "group": { "name": "collection", "entityId": "00000000-000000-000000-000000000001" } }, { "namespace": "stores", "group": { "name": "product", "entityId": "c8539b66-7a44-fe18-affc-afec4be8562a" } } ], "itemType": { "preset": "PHYSICAL" }, "paymentOption": "FULL_PAYMENT_ONLINE", "customLineItem": false }, { "id": "00000000-0000-0000-0000-000000000002", "quantity": 7, "catalogReference": { "catalogItemId": "a667539v45-9v22-b343-bbf4-eee54be85634f", "appId": "215238eb-22a5-4c36-9e7b-e7c08025e04e" }, "productName": { "original": "Pants", "translated": "Pants" }, "url": { "relativePath": "/product-page/pants", "url": "https://example.wixsite.com/my-site/product-page/pants" }, "price": { "amount": "40", "convertedAmount": "40", "formattedAmount": "$40.00", "formattedConvertedAmount": "$40.00" }, "fullPrice": { "amount": "40", "convertedAmount": "40", "formattedAmount": "$40.00", "formattedConvertedAmount": "$40.00" }, "priceBeforeDiscounts": { "amount": "40", "convertedAmount": "40", "formattedAmount": "$40.00", "formattedConvertedAmount": "$40.00" }, "descriptionLines": [], "image": { "id": "22bbe4_c4761f937348492a97df87b0a3b34bb9~mv2.jpg", "url": "https://static.wixstatic.com/media/22bbe4_c4761f937348492a97df87b0a3b34bb9~mv2.jpg", "height": 1000, "width": 1000 }, "availability": { "status": "AVAILABLE" }, "physicalProperties": { "sku": "456115376135191", "shippable": true }, "couponScopes": [ { "namespace": "stores", "group": { "name": "collection", "entityId": "00000000-000000-000000-000000000002" } }, { "namespace": "stores", "group": { "name": "product", "entityId": "a667539v45-9v22-b343-bbf4-eee54be85634f" } } ], "itemType": { "preset": "PHYSICAL" }, "paymentOption": "FULL_PAYMENT_ONLINE", "customLineItem": false } ], "buyerInfo": { "userId": "8b7eef41-7fbb-440b-928a-a442878112a3" }, "currency": "USD", "conversionCurrency": "USD", "buyerLanguage": "en", "siteLanguage": "en", "taxIncludedInPrices": false, "weightUnit": "LB", "subtotal": { "amount": "230", "convertedAmount": "230", "formattedAmount": "$230.00", "formattedConvertedAmount": "$230.00" }, "appliedDiscounts": [], "inSync": false, "createdDate": "2023-02-13T10:34:55.727Z", "updatedDate": "2023-02-14T09:20:15.053Z", "contactInfo": { "address": { "country": "US", "subdivision": "US-NY", "city": "New York", "postalCode": "10011", "addressLine": "235 West 23rd Street", "addressLine2": "3rd floor", "countryFullname": "United States", "subdivisionFullname": "New York" }, "contactDetails": { "firstName": "Jane", "lastName": "Doe", "phone": "+1234567890" } } } }
Errors

This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Event TriggersThis method triggers the following events:
Did this help?