Store Hugs Developers

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:

FieldTypeDescription
[].idinteger
[].slugstring
[].titlestring or null
[].skustring or null
[].priceMoneyFields: amount, currency, formatted.
[].regularPriceMoneyFields: amount, currency, formatted.
[].onSaleboolean
[].inStockboolean
[].ratingRating or null
[].rating.averagenumber
[].rating.countinteger
[].imagestring (uri) or null

Errors

StatusWhen
401invalid_api_key, or invalid_customer_token: the shopper's token is missing or not valid for this shop.
402The shop is suspended (message only).
403origin_not_allowed (publishable key from an unlisted site), secret_key_in_browser, or the shop is not live (message only).
404Not found, or the shop's plan has no Integration API.
429Rate 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:

FieldTypeDescription
[].idinteger
[].slugstring
[].titlestring or null
[].skustring or null
[].priceMoneyFields: amount, currency, formatted.
[].regularPriceMoneyFields: amount, currency, formatted.
[].onSaleboolean
[].inStockboolean
[].ratingRating or null
[].rating.averagenumber
[].rating.countinteger
[].imagestring (uri) or null

Errors

StatusWhen
401invalid_api_key, or invalid_customer_token: the shopper's token is missing or not valid for this shop.
402The shop is suspended (message only).
403origin_not_allowed (publishable key from an unlisted site), secret_key_in_browser, or the shop is not live (message only).
404product_not_found, or the shop's plan has no Integration API.
409idempotency_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.
422Validation errors ({ message, errors }), or an idempotency refusal(idempotency_key_reused, idempotency_key_invalid).
429Rate 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:

FieldTypeDescription
[].idinteger
[].slugstring
[].titlestring or null
[].skustring or null
[].priceMoneyFields: amount, currency, formatted.
[].regularPriceMoneyFields: amount, currency, formatted.
[].onSaleboolean
[].inStockboolean
[].ratingRating or null
[].rating.averagenumber
[].rating.countinteger
[].imagestring (uri) or null

Errors

StatusWhen
401invalid_api_key, or invalid_customer_token: the shopper's token is missing or not valid for this shop.
402The shop is suspended (message only).
403origin_not_allowed (publishable key from an unlisted site), secret_key_in_browser, or the shop is not live (message only).
404Not found, or the shop's plan has no Integration API.
409idempotency_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.
422Validation errors ({ message, errors }), or an idempotency refusal(idempotency_key_reused, idempotency_key_invalid).
429Rate limited.

Example

$products = $shopper->customer->wishlist->remove(12);