Skip to main content

Wishlist

Use the Shop Users API to create and manage wishlists for Shop users. Wishlists are built on the product list system, where users can organize saved products into named, shareable collections.

Developer preview

The Shop platform is in early access. Features and APIs may change before general availability.


In this guide, you'll learn how to do the following tasks:

  • Authenticate with the Shop APIs to get a user-scoped access token.
  • Create a wishlist for a user.
  • Add and remove products from a wishlist.

  • A Shop app with a client ID and secret.
  • A user who has connected to your app through Sign in with Shop.

Anchor to Step 1: Get a user access tokenStep 1: Get a user access token

Call the fetchTokensForUser mutation on the Shop Partners API with the user's public ID. Authenticate using your client ID and secret as HTTP Basic credentials.

cURL

curl -X POST \
https://shop.app/api/partners/graphql.json \
-H 'Content-Type: application/json' \
-u '{CLIENT_ID}:{CLIENT_SECRET}' \
-d '{
"query": "mutation { fetchTokensForUser(publicId: \"USER_PUBLIC_ID\") { accessToken refreshToken expiresIn tokenType } }"
}'

Save the accessToken from the response. You'll use it to authenticate requests to the Shop Users API.


Anchor to Step 2: Create a wishlistStep 2: Create a wishlist

Use the productListCreate mutation on the Shop Users API to create a new product list. Include the access token as a Bearer token.

cURL

curl -X POST \
https://shop.app/api/users/graphql.json \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer {ACCESS_TOKEN}' \
-d '{
"query": "mutation { productListCreate(name: \"My Wishlist\", privacyStatus: PUBLIC) { productList { id name publicId privacyStatus } userErrors { field message } } }"
}'

The response includes the product list's id, which you'll use to add items.


Anchor to Step 3: Add a product to the wishlistStep 3: Add a product to the wishlist

Use the productListItemAdd mutation to add a product variant to the wishlist:

cURL

curl -X POST \
https://shop.app/api/users/graphql.json \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer {ACCESS_TOKEN}' \
-d '{
"query": "mutation { productListItemAdd(productListId: \"LIST_ID\", shopifyShopId: 12345, shopifyVariantId: 67890) { productListItem { id shopifyVariantId } userErrors { field message } } }"
}'

Anchor to Step 4: Remove a product from the wishlistStep 4: Remove a product from the wishlist

Use the productListItemRemove mutation to remove a product variant:

cURL

curl -X POST \
https://shop.app/api/users/graphql.json \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer {ACCESS_TOKEN}' \
-d '{
"query": "mutation { productListItemRemove(productListId: \"LIST_ID\", shopifyVariantId: 67890) { deletedProductListItem { id } userErrors { field message } } }"
}'

  • Use productListUpdate to rename a wishlist or change its privacy status.
  • Query a user's wishlists with user.productLists to display them in your UI.
  • You can also use the favoritesAdd and favoritesRemove mutations to manage the user's default favorites list without creating a named product list.

Was this page helpful?