Wishlist
The signed-in shopper's wishlist. Every change answers with the whole list.
Reach it through $shopper->customer->wishlist. It needs a client with the shopper's access token (see sign-in).
List the wishlist
$shopper->customer->wishlist->list(): array
The wishlisted products the storefront still sells, newest first. Not paginated.
Returns
A list of ProductSummary arrays, each:
| Field | Type | Description |
|---|---|---|
[].id | integer | |
[].slug | string | |
[].title | string or null | |
[].sku | string or null | |
[].price | Money | Fields: amount, currency, formatted. |
[].regularPrice | Money | Fields: amount, currency, formatted. |
[].onSale | boolean | |
[].inStock | boolean | |
[].rating | Rating or null | |
[].rating.average | number | |
[].rating.count | integer | |
[].image | string (uri) or null |
Errors
| Status | When |
|---|---|
401 | invalid_api_key, or invalid_customer_token: the shopper's token is missing or not valid for this shop. |
402 | The shop is suspended (message only). |
403 | origin_not_allowed (publishable key from an unlisted site), secret_key_in_browser, or the shop is not live (message only). |
404 | Not found, or the shop's plan has no Integration API. |
429 | Rate limited. |
Example
$products = $shopper->customer->wishlist->list();
Add a product
$shopper->customer->wishlist->add(int $productId): array
Adds a product to the wishlist. Adding a product already there changes nothing. Limited like cart writes.
Parameters
| Parameter | Type | |
|---|---|---|
$productId |
int |
The product's id. |
Returns
The whole wishlist, a list of ProductSummary arrays, each:
| Field | Type | Description |
|---|---|---|
[].id | integer | |
[].slug | string | |
[].title | string or null | |
[].sku | string or null | |
[].price | Money | Fields: amount, currency, formatted. |
[].regularPrice | Money | Fields: amount, currency, formatted. |
[].onSale | boolean | |
[].inStock | boolean | |
[].rating | Rating or null | |
[].rating.average | number | |
[].rating.count | integer | |
[].image | string (uri) or null |
Errors
| Status | When |
|---|---|
401 | invalid_api_key, or invalid_customer_token: the shopper's token is missing or not valid for this shop. |
402 | The shop is suspended (message only). |
403 | origin_not_allowed (publishable key from an unlisted site), secret_key_in_browser, or the shop is not live (message only). |
404 | product_not_found, or the shop's plan has no Integration API. |
409 | idempotency_in_progress: a request with this Idempotency-Key is still running. Retry with the same key after Retry-After seconds; the first answer is then replayed. |
422 | Validation errors ({ message, errors }), or an idempotency refusal(idempotency_key_reused, idempotency_key_invalid). |
429 | Rate limited. |
Example
$products = $shopper->customer->wishlist->add(12);
Remove a product
$shopper->customer->wishlist->remove(int $productId): array
Removes a product from the wishlist.
Parameters
| Parameter | Type | |
|---|---|---|
$productId |
int |
The product's id. |
Returns
The whole wishlist, a list of ProductSummary arrays, each:
| Field | Type | Description |
|---|---|---|
[].id | integer | |
[].slug | string | |
[].title | string or null | |
[].sku | string or null | |
[].price | Money | Fields: amount, currency, formatted. |
[].regularPrice | Money | Fields: amount, currency, formatted. |
[].onSale | boolean | |
[].inStock | boolean | |
[].rating | Rating or null | |
[].rating.average | number | |
[].rating.count | integer | |
[].image | string (uri) or null |
Errors
| Status | When |
|---|---|
401 | invalid_api_key, or invalid_customer_token: the shopper's token is missing or not valid for this shop. |
402 | The shop is suspended (message only). |
403 | origin_not_allowed (publishable key from an unlisted site), secret_key_in_browser, or the shop is not live (message only). |
404 | Not found, or the shop's plan has no Integration API. |
409 | idempotency_in_progress: a request with this Idempotency-Key is still running. Retry with the same key after Retry-After seconds; the first answer is then replayed. |
422 | Validation errors ({ message, errors }), or an idempotency refusal(idempotency_key_reused, idempotency_key_invalid). |
429 | Rate limited. |
Example
$products = $shopper->customer->wishlist->remove(12);