Create Compare Item
Add a product to the authenticated customer's comparison list.
Endpoint
POST /api/shop/compare-itemsRequest Headers
| Header | Required | Description |
|---|---|---|
Content-Type | Yes | application/json |
X-STOREFRONT-KEY | Yes | Your storefront API key |
Authorization | Yes | Customer Bearer token (Bearer <accessToken>) |
Request Body
json
{
"productId": 1
}| Field | Type | Required | Description |
|---|---|---|---|
productId | integer | Yes | ID of the product to add to the compare list. |
Response Fields (201 Created)
| Field | Type | Description |
|---|---|---|
id | integer | New compare item ID |
product | object | Associated product details |
customer | object | Customer who added the item |
TIP
The exact response shape follows the package's serialization. Confirm field presence against the live endpoint for your installation.
Validation
productIdis required and must reference an existing product.- A valid customer Bearer token is required.
Use Cases
- "Add to compare" buttons on product cards
- Build a side-by-side product comparison list

