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:
| Parameter | Type | Required | Description |
|---|---|---|---|
product | int | Yes | yStore product ID (yuiId) |
qty | int | Yes | Quantity to add |
configuration[{code}] | string | Configurable only | Attribute values (e.g. configuration[color]=red) |
custom | object | No | Custom 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 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:
| Parameter | Type | Required | Description |
|---|---|---|---|
id | int | Yes | Cart line item ID |
qty | int | Yes | New quantity (0 to remove) |
custom | object | No | Updated 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:
| Parameter | Default | Description |
|---|---|---|
force-reload | 0 | Set 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:
| Parameter | Default | Description |
|---|---|---|
force-reload | 0 | Set 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 related items
GET /shop/cart/get-related-items
Returns related products based on cart contents.
Query parameters:
| Parameter | Default | Description |
|---|---|---|
name | — | Product name filter |
exclude | 0 | Product ID to exclude from results |
limit | 4 | Maximum number of results |
Apply coupon
POST /shop/cart/add-coupon
Applies a coupon code to the cart.
Body parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
coupon_code | string | Yes | Coupon code to apply |
siteMode | string | No | Site (default) or CP |
remove | int | No | 1 to remove the code instead of adding it |
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:
| Parameter | Type | Required | Description |
|---|---|---|---|
coupon_code | string | Yes | Code to remove |
Set currency
POST /shop/currency/set
Switches the cart's active currency.
Body parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
currency | string | Yes | ISO 4217 currency code (e.g. EUR, USD) |
Share cart — create link
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.
| Parameter | Description |
|---|---|
token | Hex 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.
| Parameter | Description |
|---|---|
id | Cart line item ID |
Body parameters:
| Parameter | Type | Description |
|---|---|---|
wishlist | int | Wishlist ID to add to (optional — uses default if omitted) |