Skip to main content
Version: 2.0.0

Cart Endpoints

All cart endpoints are prefixed with /shop/cart/.


Add to cart

POST /shop/cart/add

Adds a product (or variant) to the current session cart.

Body parameters:

ParameterTypeRequiredDescription
productintYesyStore product ID (yuiId)
qtyintYesQuantity to add
configuration[{code}]stringConfigurable onlyAttribute values (e.g. configuration[color]=red)
customobjectNoCustom line item data passed through to the order

Response (AJAX mode):

{
"success": true,
"message": "Product \"Blue T-Shirt\" added to cart.",
"showPopup": true,
"product": {
"id": 412,
"name": "Blue T-Shirt",
"sku": "tshirt-blue-m",
"qty": 1,
"price": 29.90,
"value": 29.90,
"image": "https://yourstore.com/assets/tshirt.jpg",
"url": "https://yourstore.com/shop/products/blue-t-shirt"
}
}
AJAX mode

AJAX responses are returned when salesCheckoutEnableAjax is enabled in settings and the request has an X-Requested-With: XMLHttpRequest header. Otherwise the endpoint redirects back with a flash message.


Update item

POST /shop/cart/update-item

Updates the quantity of an existing cart line item.

Body parameters:

ParameterTypeRequiredDescription
idintYesCart line item ID
qtyintYesNew quantity (0 to remove)
customobjectNoUpdated custom line item data

Remove item

POST /shop/cart/remove-item/{id}

Removes a single item from the cart by its line item ID.


Clear cart

POST /shop/cart/clear

Removes all items from the current cart.


Get cart items

GET /shop/cart/get-items

Returns the rendered cart items HTML fragment — used by the mini-cart and cart page to update without a full page reload.

Query parameters:

ParameterDefaultDescription
force-reload0Set to 1 to bypass the response cache
store(site default)Store view code

Get cart totals

GET /shop/cart/get-totals

Returns the rendered totals block (subtotal, shipping, tax, grand total).

Query parameters:

ParameterDefaultDescription
force-reload0Set to 1 to bypass the response cache

Get cross-sell items

GET /shop/cart/get-cross-items

Returns cross-sell product suggestions for items currently in the cart.


GET /shop/cart/get-related-items

Returns related products based on cart contents.

Query parameters:

ParameterDefaultDescription
nameProduct name filter
exclude0Product ID to exclude from results
limit4Maximum number of results

Apply coupon

POST /shop/cart/add-coupon

Applies a coupon code to the cart.

Body parameters:

ParameterTypeRequiredDescription
coupon_codestringYesCoupon code to apply
siteModestringNoSite (default) or CP
removeintNo1 to remove the code instead of adding it
Feature flag

This endpoint is only registered when salesCouponsEnabled is on.


Remove coupon

POST /shop/cart/remove-coupon

Removes an applied coupon from the cart.

Body parameters:

ParameterTypeRequiredDescription
coupon_codestringYesCode to remove

Set currency

POST /shop/currency/set

Switches the cart's active currency.

Body parameters:

ParameterTypeRequiredDescription
currencystringYesISO 4217 currency code (e.g. EUR, USD)

POST /shop/cart/share-create

Creates a shareable cart link. Returns the share token.


Share cart — send emails

POST /shop/cart/share-send-emails

Sends the shared cart link by email to one or more recipients.


Share cart — restore

GET /shop/cart/share/{token}

Restores a shared cart by its token. Merges the shared items into the current session cart.

ParameterDescription
tokenHex share token from the share-create response

Move cart item to wishlist

POST /shop/cart/wishlist-add/{id}

Moves an item from the cart to a wishlist.

ParameterDescription
idCart line item ID

Body parameters:

ParameterTypeDescription
wishlistintWishlist ID to add to (optional — uses default if omitted)