POST
/
api
/
v2
/
storefront
/
wishlists
/
{token}
/
add_item
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"
        }
      }
    }
  }
}

Authorizations

Authorization
string
header
required

User token to authorize Cart and Checkout requests.

It is required to associate Cart with the User.

Path Parameters

token
string
required

The token is a unique string used to identify the target resource.

Body

application/vnd.api+json
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.
variant_id
string
required

The variant ID that is to be added to the wishlist.

quantity
number

Set a quantity greater than 0, or omit the quantity param if your wishlist does not support quantities.

Response

200
application/vnd.api+json
200 Success - Returns an array of `wished_item` objects.
data
object
required
included
object[]

Variant records track the individual variants of a Product. Variants are of two types: master variants and normal variants.