curl --request POST \
--url https://demo.spreecommerce.org/api/v2/storefront/wishlists/{token}/add_item \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/vnd.api+json' \
--data '
{
"variant_id": "149",
"quantity": 3
}
'{
"data": {
"id": "1",
"type": "wished_item",
"attributes": {
"quantity": 3,
"price": "55.99",
"total": "167.97",
"display_price": "$55.99",
"display_total": "$167.97"
},
"relationships": {
"variant": {
"data": {
"id": "149",
"type": "variant"
}
}
}
}
}The Add Item to Wishlist endpoint adds a variant to an existing wishlist by creating a new wished_item. A wished item in a wishlist is comparable to a line item in a cart.
Each wished item references a single variant, holds the desired quantity and returns price information determined by the variant price in current currency, and desired quantity.
curl --request POST \
--url https://demo.spreecommerce.org/api/v2/storefront/wishlists/{token}/add_item \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/vnd.api+json' \
--data '
{
"variant_id": "149",
"quantity": 3
}
'{
"data": {
"id": "1",
"type": "wished_item",
"attributes": {
"quantity": 3,
"price": "55.99",
"total": "167.97",
"display_price": "$55.99",
"display_total": "$167.97"
},
"relationships": {
"variant": {
"data": {
"id": "149",
"type": "variant"
}
}
}
}
}User token to authorize Cart and Checkout requests.
It is required to associate Cart with the User.
Passing a quantity value is optional for those wishlist systems that do not support quantities. In this scenario, the returned quantity value will always be 1, allowing the add-to-cart and pricing to reflect the single representation of the wished item accurately.
If the wishlist system you are building allows for setting quantity, add the quantity attribute to the request body with an integer value greater than zero.
200 Success - Returns an array of wished_item objects.
Show child attributes
Show child attributes
"1"
Show child attributes
"SKU-1001"
"15.99"
"USD"
"$15.99"
"10"
"10"
"10"
"10"
Indicates if Variant is the master Variant
"Size: small, Color: red"
Indicates if Variant is in stock or backorderable
Indicates if Variant is in stock
Show child attributes
Was this page helpful?