Troubleshooting
If you are developing locally without a backend, the most common fix is setting
VITE_API_BASE_URL=https://api.shoppex.io.Theme loads but shows no data
Theme loads but shows no data
Check:
- Did you set
VITE_SHOP_SLUGin local dev? - Did you set
VITE_API_BASE_URLto a reachable API? - Did SDK init run before your first API calls?
Storefront shows 0 stats / 0 products after a migration or import
Storefront shows 0 stats / 0 products after a migration or import
Symptom:
- The page renders
0 SALES,0+ PRODUCTS,0.0 RATING - but
shoppex.getStorefront()in the network tab returns real data
- Your deployed
index.htmlcontains injectedwindow.__SHOPPEX_INITIAL__that is stale (it was generated at build/deploy time). - If your theme only reads initial data and never revalidates, the UI can get stuck on that stale snapshot.
- Make your data hook revalidate in the background after
shoppex.init():- first render uses
window.__SHOPPEX_INITIAL__(fast) - then call
shoppex.getStorefront()and update state (fresh)
- first render uses
Localhost tries to call http://localhost:3001
Localhost tries to call http://localhost:3001
This happens when:
- you run the theme on localhost
- you did not set
VITE_API_BASE_URL
- set
VITE_API_BASE_URL=https://api.shoppex.io
<!--initial-data--> not injected
<!--initial-data--> not injected
If you expect
window.__SHOPPEX_INITIAL__ but it is missing:- make sure your built
dist/index.htmlcontains<!--initial-data--> - if it is missing, Shoppex will skip injection
Build succeeds but storefront 404s assets
Build succeeds but storefront 404s assets
Common causes:
- your
dist/index.htmlreferences assets that were not written todist/ - your build output path is not
dist/
dist/index.htmlexistsdist/assets/*exists- asset URLs in the HTML match the files in
dist/
SDK not initialized
SDK not initialized
shoppex.init() is synchronous and must run before any SDK method call.Common cause: calling getStorefront() (or any other method) before init(). In that case the SDK throws a NotInitializedError.Checkout fails (success: false)
Checkout fails (success: false)
Possible causes:
- Cart might be empty — check
shoppex.getCart().length - API might be unreachable — check the network tab in devtools
- If using MSW: checkout is not mocked. You need a real API for checkout to work.
Theme settings not applying
Theme settings not applying
Check:
- Verify
fetchPublishedThemeSettings()returns data (notnull) - Check CSS variable names match your CSS (inspect elements in devtools)
- Verify
mergeSettings()is called with correct arguments (defaults first, then published)
MSW not intercepting requests
MSW not intercepting requests
Check:
- Ensure
VITE_USE_MSW=trueis set in your environment - Check
mockServiceWorker.jsexists in yourpublic/directory - Verify handler URL patterns match — handlers use
'*/v1/...'wildcard patterns
Hydration mismatch after pre-rendering
Hydration mismatch after pre-rendering
Server and client must render identical content. Check:
InitialDataProviderreceives the same data on server and client- Avoid
Date.now()orMath.random()in the initial render - Make sure conditional rendering is consistent between server and client