Add item to wishlist
Adds a variant to the wishlist
POST
Spree SDK
Authorizations
Publishable API key for store access
JWT token for authenticated customers
Documentation Index
Fetch the complete documentation index at: /docs/llms.txt
Use this file to discover all available pages before exploring further.
Adds a variant to the wishlist
import { createClient } from '@spree/sdk'
const client = createClient({
baseUrl: 'https://your-store.com',
publishableKey: '<api-key>',
})
const item = await client.wishlists.items.create('wl_abc123', {
variant_id: 'variant_abc123',
quantity: 1,
}, {
token: '<token>',
})curl --request POST \
--url http://{defaultHost}/api/v3/store/wishlists/{wishlist_id}/items \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'x-spree-api-key: <api-key>' \
--data '
{
"variant_id": "variant_abc123",
"quantity": 1
}
'{
"id": "wi_gbHJdmfrXB",
"variant_id": "variant_gbHJdmfrXB",
"product_id": "prod_gbHJdmfrXB",
"wishlist_id": "wl_UkLWZg9DAJ",
"quantity": 1,
"variant": {
"id": "variant_gbHJdmfrXB",
"product_id": "prod_gbHJdmfrXB",
"sku": "SKU-250",
"options_text": "",
"track_inventory": true,
"media_count": 0,
"preorder_ships_at": null,
"thumbnail_url": null,
"purchasable": true,
"in_stock": false,
"backorderable": true,
"preorder": false,
"weight": 0,
"height": null,
"width": null,
"depth": null,
"price": {
"id": "price_gbHJdmfrXB",
"amount": "19.99",
"amount_in_cents": 1999,
"compare_at_amount": null,
"compare_at_amount_in_cents": null,
"currency": "USD",
"display_amount": "$19.99",
"display_compare_at_amount": null,
"price_list_id": null
},
"original_price": null,
"option_values": []
}
}Publishable API key for store access
JWT token for authenticated customers
Was this page helpful?
import { createClient } from '@spree/sdk'
const client = createClient({
baseUrl: 'https://your-store.com',
publishableKey: '<api-key>',
})
const item = await client.wishlists.items.create('wl_abc123', {
variant_id: 'variant_abc123',
quantity: 1,
}, {
token: '<token>',
})curl --request POST \
--url http://{defaultHost}/api/v3/store/wishlists/{wishlist_id}/items \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'x-spree-api-key: <api-key>' \
--data '
{
"variant_id": "variant_abc123",
"quantity": 1
}
'{
"id": "wi_gbHJdmfrXB",
"variant_id": "variant_gbHJdmfrXB",
"product_id": "prod_gbHJdmfrXB",
"wishlist_id": "wl_UkLWZg9DAJ",
"quantity": 1,
"variant": {
"id": "variant_gbHJdmfrXB",
"product_id": "prod_gbHJdmfrXB",
"sku": "SKU-250",
"options_text": "",
"track_inventory": true,
"media_count": 0,
"preorder_ships_at": null,
"thumbnail_url": null,
"purchasable": true,
"in_stock": false,
"backorderable": true,
"preorder": false,
"weight": 0,
"height": null,
"width": null,
"depth": null,
"price": {
"id": "price_gbHJdmfrXB",
"amount": "19.99",
"amount_in_cents": 1999,
"compare_at_amount": null,
"compare_at_amount_in_cents": null,
"currency": "USD",
"display_amount": "$19.99",
"display_compare_at_amount": null,
"price_list_id": null
},
"original_price": null,
"option_values": []
}
}