Custom storefront implementation with Shopify.
"Private App" is required for use "StoreFront API" (and "CustomApp" is not enough).
- Create "Private App" from Store admin page.
- Enable "Storefront API" section's "Allow this app to access your storefront data using the Storefront API" option.
- Hit "Save".
- Copy "Storefront access token" from admin page and store that as
SHOPIFY_API_STOREFRONT_ACCESS_TOKEN
Environment variable. - Restart dev server for applying environment variables change.
- Create "Custom App" from Shopify's Partner Dashboard or Store admin page.
- Set following fields and Hit "Save"
- App URL:
http://localhost:3000/api/auth/install
- Allowed redirection URL(s):
http://localhost:3000/api/auth/callback
- App URL:
- After "Custom App" are created, fetch these values from app page and fill
.env
.- API key ->
SHOPIFY_API_KEY
- API secret key ->
SHOPIFY_API_SECRET
- API key ->
# Install dependencies
npm i
# Run development server
npm run dev
- Copy
Merchant install link
from app page and open that URL in your Browser. - When "Authorization page" is shown, hit "Install app" link.
- See dev server's console log for generated
shopAccessToken
. and store that asSHOPIFY_API_SHOP_ACCESS_TOKEN
Environment variable. - Restart dev server for applying environment variables change.