Skip to content
Mehrdad Pajuhaan edited this page Oct 23, 2026 · 1 revision

FAQ

Answers to the questions developers ask most often about the Storefront SDK, including the error messages you may see in the console and how to fix them. If your question is not here, search the issues or open a new one.

❌ The shop name is not specified in the meta tag with the name 'shop-name'.

StorefrontSDK.Setup() could not find your shop. Add <meta name="shop-name" content="your-shop"> to <head>, make sure Setup() runs after the <head> is parsed, or pass the name directly: StorefrontSDK.Setup("your-shop"). See Setup and Meta Tags.

The service url is not defined in [service-url] meta tag! (or a similar message for a CDN or iframe tag)

Selldone Core needs the platform meta tags: service-url, selldone-xapi, selldone-iframe, selldone-cdn-images, selldone-cdn-jsons and selldone-cdn-ar at minimum. Copy the full block from Getting Started. If you cannot edit <head>, set the same keys on window.selldone_config before loading the SDK.

The console says CSRF token not found!. Is that a problem?

No. It only means there is no csrf-token meta tag, so no X-CSRF-TOKEN header is sent. Custom front ends that call XAPI with a bearer token or as guests do not need it.

Do I need to call SelldoneCore.Setup() myself?

Not necessarily. StorefrontSDK.Setup() calls it if Selldone Core is not initialized yet. Call it yourself first when you want to pass options, for example SelldoneCore.Setup({ i18n: i18n.global }) so Core helpers can translate messages.

Should I use list() or fetchProducts()? And why doesn't sortBy work?

Use products.list(). fetchProducts() is a deprecated alias that still works. For product lists the sort option is sort ("newest", "cheapest", "most_popular", …); sortBy / sortDesc belong to products.subscription.getContents(). The favorites filter is spelled only_stared. All options are listed in Products.

I get ⚠ Always call cache() before then()!, or my cache callback never runs.

Chain .cache(callback) directly on the request, before .then():

window.$storefront.products.list(null, 0, 10).cache(render).then(render);

The callback only runs when a cached response exists, so it is normal that it does not fire on the first request. It is also skipped when optimize() already returned the cached data through then().

optimize() seems to have no effect; every call still hits the server.

Responses are stored only for requests chained with .cache(). Use both: window.$storefront.products.optimize(600).list(...).cache(render).then(render). The store is in memory, so it starts empty on every page load.

My product list does not refresh after I changed something.

optimize(seconds) is stored on the namespace object, so later calls on window.$storefront.products keep using the cache window. Call .force() before the request that must hit the server: window.$storefront.products.force().list(...).

My catch receives undefined.

The request was canceled because you enabled cancellation() and a newer request to the same URL started. Ignore it: if (error === undefined) return;.

The customer is signed out after a page reload.

The OTP methods return a token but do not save it. Store it in the access-token cookie with the shop prefix as path and set the Authorization header, as shown in Authentication → Store the access token. If you changed the cookie name, pass the same name to StorefrontSDK.Setup(undefined, { cookie_key_access_token: "my_cookie" }).

The guest basket is empty after a reload.

Guests are identified by a guest code. Save shop.guest_code from fetchShop() with StorefrontLocalStorages.SetShopGuestCode() and set the S-Guest header. See Basket and Checkout → Guest baskets.

Where are the checkout, payment and order endpoints?

The SDK wraps adding and removing items. Everything else is available as URL builders on window.XAPI (for example GET_BASKET_BILL, POST_BUY_BASKET, GET_ORDER_BASKET_INFO). Send the requests with window.axios, which already carries the right headers. See Basket and Checkout → Checkout.

Can I use the SDK with server-side rendering (Next.js, Nuxt…)?

The SDK reads document.head, localStorage and cookies, so it must run in the browser. Call StorefrontSDK.Setup() on the client only (for example in a client-side entry, a useEffect, or onMounted).

How do I work on the SDK locally?

Clone the repository and follow DEVELOPMENT.md: run yarn link in the SDK and yarn link "@selldone/sdk-storefront" in your app (and yarn link "@selldone/core-js" to use a local Core). yarn build compiles TypeScript, yarn bundle produces the ESM, CommonJS and browser bundles with Rollup. Tests run with Vitest in jsdom; tests/SetupTests.ts injects the meta tags.

Next steps

Clone this wiki locally