Toggle Wishlist Item
Add a product to the wishlist if it is not present, or remove it if it already is.
Endpoint
POST /api/shop/wishlists/toggleRequest 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": 2
}| Field | Type | Required | Description |
|---|---|---|---|
productId | integer | Yes | ID of the product to toggle in the wishlist. |
Response Fields (200 OK)
| Field | Type | Description |
|---|---|---|
id | integer | Wishlist item ID (present when the item was added) |
message | string | Confirmation message indicating whether the item was added or removed |
Behaviour
- If the product is not in the wishlist, it is added and a "added" message is returned.
- If the product is in the wishlist, it is removed and a "removed" message is returned.
Use Cases
- A single heart/wishlist toggle button on product cards
- One-tap add/remove without checking current state first

