Skip to content

Create Wishlist Item ​

Add a product to the authenticated customer's wishlist.

Endpoint ​

POST /api/shop/wishlists

Request Headers ​

HeaderRequiredDescription
Content-TypeYesapplication/json
X-STOREFRONT-KEYYesYour storefront API key
AuthorizationYesCustomer Bearer token (Bearer <accessToken>)

Request Body ​

json
{
  "productId": 2
}
FieldTypeRequiredDescription
productIdintegerYesID of the product to add to the wishlist.

Response Fields (201 Created) ​

The created wishlist row. Product, customer, and channel come back as path references, not nested objects — the product's name and price are not part of this payload.

FieldTypeDescription
idintegerNew wishlist row ID. Keep it for Delete and Move to Cart.
productstringPath of the saved product, e.g. /api/shop/products/126.
customerstringPath of the owning customer.
channelstringPath of the channel the item was saved on.
createdAt / updatedAtstringISO 8601 timestamps.

Behaviour ​

  • The row is scoped to the current channel, so the same product can be saved once per channel.
  • Adding a product that is already saved is rejected with 400 — it is not a silent no-op. A heart button that must also un-save should call Toggle instead.
  • Any product type can be saved, including configurable and bundled ones. Option choices are not stored, which is why those types cannot later be moved straight to the cart.

Use Cases ​

  • "Add to wishlist" on a product page — post the product ID and keep the returned row ID so the same button can remove it again without re-listing.
  • Save for later from the cart — add here, then remove the cart line; there is no single endpoint that does both.

Best Practices ​

  • Prefer Toggle for a heart icon — this endpoint only adds, and a second tap produces a 400 the UI has to special-case.
  • Do not render from this response — it carries no product name, price, or image; keep the details you already had on screen.
  • Treat 403 as "log in first" — guests get no wishlist, so the control should prompt for login rather than retry.

Released under the MIT License.