Printify
Merch catalog and print-on-demand fulfilment for the /merchandise pages
Printify Integration
Merch (tour shirts, apparel, accessories) is printed and shipped on demand by Printify. The storefront does not keep merch in the Product table: it reads the catalog straight from the Printify shop and hands paid orders to Printify.
Setup
- In Printify, open My Profile → Connections, create a personal access token with the products and orders scopes.
- Add it to the storefront's Vercel project as
PRINTIFY_API_TOKEN. The merch page sells the products of every shop on the account, such as an API shop and the shop connected to Etsy, and each order goes to the shop its product is in. SetPRINTIFY_SHOP_IDto a comma-separated list only to sell from some shops. - Redeploy.
/admin/merchandiseshows Connected and lists the products for sale.
Square must already be configured (SQUARE_ACCESS_TOKEN, SQUARE_LOCATION_ID, SQUARE_SANDBOX=false in production), since merch is paid for through Square.
What appears on the site
/merchandiselists every product in the shop that has at least one enabled, in-stock variant, newest first. A product hidden in Printify after being published is left off./merchandise/[productId]shows the photos, color and size choices and the price for each variant.- Prices, titles, descriptions and photos are edited in Printify. The site caches the catalog for five minutes; checkout always re-reads the price live.
How an order flows
- Buy now calls
POST /api/merchandise/checkout, which prices the variant from Printify, creates a Square payment link (with a flat shipping fee: $6.99 for the first item, $2.50 for each additional) and records aMerchOrderasAWAITING_PAYMENT. - The customer pays on Square's hosted page, which also collects the shipping address.
- Square redirects to
/merchandise/order-complete, which checks the Square order is paid in full for the expected amount and submits it to Printify (MerchOrder→SUBMITTED). - If the customer never reaches that page, the
/api/cron/merch-orderssweep (every 15 minutes) submits it instead. Orders Printify refuses are markedFAILEDwith the error and retried by the sweep; unpaid links expire after 7 days.
Each order is claimed before it is sent, so it reaches Printify once. Printify emails the customer tracking when it ships.
Code: lib/printify/client.ts, lib/merchandise/catalog.ts, lib/merchandise/orders.ts.
Limits
- Shipping is a flat fee and sales tax is not added on merch orders.
- Orders are created in the configured Printify shop through the API; that shop must allow API orders.
How is this guide?
Edit on GitHub
Last updated on