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.
The Shop platform is in early access. Features and APIs may change before general availability.
The Shop platform is in early access. Features and APIs may change before general availability.
Anchor to What you'll learnWhat you'll learn
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.
Anchor to RequirementsRequirements
- 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
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
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
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
Anchor to Next stepsNext steps
- Use
productListUpdateto rename a wishlist or change its privacy status. - Query a user's wishlists with
user.productListsto display them in your UI. - You can also use the
favoritesAddandfavoritesRemovemutations to manage the user's default favorites list without creating a named product list.