Add a customer wishlist to a Shopify store
Signed-in customers save products with a heart on product pages and keep them on a wishlist page rendered in the store's own theme. It needs no Shopify scopes: wishlists live in the app's records, and product details come from Liquid on the storefront.
What you'll build
What it shows: A block that asks the app for its state, proxy routes answered as JSON and as application/liquid, and a unique field that keeps one record per customer and product.
Before you start
- The CLI:
npm i -g @inferencebureau/apps, thenib-apps loginonce. - A Shopify Partner organization, and a development store to install on.
- Resend, for data requests.
Create the app from the recipe
One command creates the app on Inference Bureau and downloads its files into ./my-wishlist. Shopify recipes need --platform shopify.
ib-apps create my-wishlist --platform shopify --recipe wishlistTour what the recipe loaded
The recipe lies over the Shopify starter: files of the same path are replaced, and the starter's storefront block is dropped. Here's where each piece lives.
| Where | What's there |
|---|---|
api/models/wishlistItem/schema.ib.ts | One saved product, with a unique key (<shop>:<customerId>:<productGid>) so a product is saved once. |
actions/create.ts, delete.ts | Save (sets key and addedAt) and remove. |
extensions/wishlist/ | The Wishlist button block. Shopify renders it in the "not saved" state; its script asks the app whether this customer saved the product, then saves or removes it. Guests see "Sign in to save". |
web/lib/wishlist.ts | What the proxy routes share: the signed-in customer from verifyProxyRequest, reads and writes through createClient(), and the checks every value passes. At most 200 products. |
web/app/proxy/wishlist/route.ts | The wishlist page, answered as application/liquid. Liquid looks each product up with all_products (20 per render, so 20 per page). |
proxy/wishlist/state/, items/ | GET ?product=<gid> answers { saved }; POST { op, product, handle } adds or removes. JSON only, so a form on another site can't post as a signed-in customer. |
web/app/page.tsx, summary.tsx | The admin page: how many products are saved, by how many customers, and the 20 most wishlisted. |
api/actions/shopifyCustomers*.ts | Shopify's privacy webhooks: customers/redact deletes the customer's wishlist; customers/data_request emails them to the store's owner through the team's own Resend account. |
export const schema: ModelSchema = {
type: "ib/model-schema/v1",
fields: {
shop: { type: "string", storageKey: "wlShop", validations: { required: true } },
customerId: { type: "string", storageKey: "wlCustomer", validations: { required: true } },
productGid: { type: "string", storageKey: "wlProduct", validations: { required: true, regex: { pattern: "^gid://shopify/Product/\\d+$" } } },
productHandle: { type: "string", storageKey: "wlHandle", validations: { required: true, regex: { pattern: "^[a-z0-9][a-z0-9-]*$" } } },
variantGid: { type: "string", storageKey: "wlVariant" },
addedAt: { type: "dateTime", storageKey: "wlAddedAt" },
key: { type: "string", storageKey: "wlKey", validations: { required: true, unique: true } },
},
};Check what it set on the app
Nothing to do here: this is what the recipe configured, so you know where to look in Settings later.
customers/redact, customers/data_requestConnect Shopify and install
- Create the Shopify app in your Partner organization
- Install on a development store
- Add the Wishlist button block to a product template in the theme editor
Run it
ib-apps dev syncs both ways while you work and runs the development server. Saving anything under extensions/ releases it to the development Shopify app by itself.
cd my-wishlist
ib-apps devLogs show a succeeded config release once the extension is live.
Try it end to end
Make it yours
extensions/wishlist/assets/wishlist.css and blocks/wishlist-button.liquid.
The Liquid the page renders is in web/app/proxy/wishlist/route.ts.
ib-apps deploy sends development to production. See Deploys.