Svelte Commerce × Saleor
Svelte Commerce on Saleor
The Saleor connector talks to Saleor’s GraphQL API from a single environment variable. Its guide describes cart, checkout and sign-in as Saleor-native, but the coverage script counts none of the three as wired, so for now it cannot sell.
- 28/43 services wired
- @misiki/saleor-connector 1.0.3
- Cart not yet wired
- Checkout not yet wired
- Sign-in (auth) not yet wired
What works on Saleor today
Cannot sell yet. The coverage script counts cart, checkout and sign-in as not wired — along with orders, categories, coupons, search, addresses, pages and payment methods — and CONNECTORS.md says this connector predates the current wiring pass. Its own guide adds that the card gateways throw “not implemented”.
Cart
Not yet wired, by the coverage script’s measure.
Checkout
Not yet wired, by the coverage script’s measure.
Sign-in (auth)
Not yet wired, by the coverage script’s measure.
Known gaps: auth, cart, checkout, order, category, coupon, search, address, user, page, payment-method
28 of 43 services wired, read from CONNECTORS.md on ; npm may carry a newer patch. How coverage is measured.
What the connector calls on Saleor
The connector calls Saleor’s GraphQL API at the single endpoint given in PUBLIC_SALEOR_API_URL, through the graphql-request client, with every catalogue query scoped to the channel default-channel.
The connector sends no store credential, only the endpoint URL; when localStorage holds a saleor_token, each GraphQL request carries it as authorization: Bearer <token>, and Svelte Commerce’s coverage script does not count shopper sign-in as wired.
| Service | What it requests |
|---|---|
product | query ListProducts (products(first, channel, filter: { search, categories }), reading totalCount and edges.node) |
product | query GetProduct (product(slug, channel)) for a product page |
collection | query ListCollections (collections(first, filter: { search }, channel)) and query GetCollection (collection(slug, channel)) |
profile | query GetMe (me) to read the profile and mutation AccountUpdate to save it |
Saleor rules the connector follows
- The channel is fixed in the source as
default-channelon every product and collection query, so a Saleor store must have a channel with that slug. - The product and collection lists send
firstwith no cursor, so they return the first 20 records whatever page is asked for, and the total comes from the connection’stotalCount. - The product queries request only
thumbnailfor images andpricing.priceRange.start.grossfor money, so a product carries one image, its price andmrpare the same figure, and stock is reported as 0. - Saleor returns rich-text descriptions as JSON blocks, and the connector joins the
data.textof each block and strips HTML tags to make a plain-text description. - When a GraphQL error mentions an expired or invalid token, the connector sends one
mutation TokenRefreshwith thesaleor_refresh_tokenfromlocalStorageand retries; if that fails it removes both tokens and clears themeandconnect.sidcookies.
Read from the source of misiki-in/saleor-connector at commit 87c3f2e of . Where the code has changed since, the code is right.
Quick start
From nothing to a Svelte Commerce storefront reading Saleor. You need Node.js and a Saleor to point it at; the storefront holds no data of its own.
Clone it, choose the connector, point it at Saleor
# 1 — get the storefront
git clone https://github.com/itswadesh/svelte-commerce
cd svelte-commerce
# 2 — one connector at a time: remove the two the storefront ships with, add this one
npm uninstall @misiki/litekart-connector @misiki/vendure-connector
npm i @misiki/saleor-connector
# 3 — point it at your Saleor GraphQL endpoint
echo PUBLIC_SALEOR_API_URL=https://your-store.saleor.cloud/graphql/ >> .env
# 4 — run it
npm run dev Switching works the same way on every backend: what all 26 share, from one connector at a time to store identity.
Environment variables
| Variable | Required | What it does |
|---|---|---|
PUBLIC_SALEOR_API_URL | Yes | The full Saleor GraphQL endpoint, such as https://your-store.saleor.cloud/graphql/ — the endpoint, not just the host. |
PUBLIC_CONNECTOR | No | Only when more than one connector is installed: @misiki/saleor-connector names the one this build runs on. |
The Litekart trio is not used in Saleor mode; /health reports ready when PUBLIC_SALEOR_API_URL is set and the Saleor connector is active.
Every variable here begins PUBLIC_, and SvelteKit sends PUBLIC_ variables to the browser: treat each value you set as published.
What to set up on Saleor
- Turn off email confirmation for user registration.
- Set
isPhoneMandatorytofalse. - Allow unpaid orders in the order settings.
- Allow unpaid orders in the channel settings too.
- Allow the storefront’s origin in CORS: the browser calls
PUBLIC_SALEOR_API_URLdirectly.
How the integration works
At boot, init in both hooks (through src/lib/core/connectors/init.ts) writes PUBLIC_SALEOR_API_URL onto the connector’s BaseService.SALEOR_API_URL. The server hook covers server rendering; the client hook covers the browser, which must reach the public Saleor URL in production.
By the guide’s account, cart, shipping rates, payment-method listing and cash-on-delivery checkout are Saleor-native GraphQL; categories map to Saleor categories; and the profile page delegates to Saleor’s me and accountUpdate. checkoutComplete requires an email on the checkout, so the static store config defaults isEmailMandatory to true.
Store identity, menus and plugin toggles are static — default-store.json under the default export of kitcommerce.config.ts. CMS pages are the connector’s own static placeholders. Any other Litekart REST path is never requested: list reads resolve empty, single-record reads and writes throw. From connector 1.0.4 the store lookup it once inherited from Litekart is answered by the connector itself.
The coverage script and the guide disagree. The script counts a service as wired only if it reaches the connector’s own HTTP layer, and it does not count auth, cart, checkout, order, category, coupon, search, address, user, page or payment-method. CONNECTORS.md names Medusa and Saleor as the next candidates for the source-verification sweep.
Limitations on Saleor
- Sign-in (auth): not wired — the coverage script does not count it, though the guide describes email sign-in as native GraphQL.
- Cart: not wired — the coverage script does not count it, though the guide describes the cart as Saleor-native.
- Checkout: not wired — the coverage script does not count it, though the guide describes cash-on-delivery checkout as Saleor-native.
- CMS pages: not wired — CMS-style pages show the connector’s placeholder content.
- The card gateways — Razorpay, Stripe, PhonePe, PayPal, Cashfree, Affirm — throw “not implemented” in this connector.
- No OTP sign-in:
getOtpthrows. - If the Saleor catalogue has no matching products, product grids render their empty or loading states; the pages still work.
- The Conversational Shopping assistant is Litekart-only; its widget stays hidden in Saleor mode without firing requests.
Troubleshooting Saleor
| When you see | What to do |
|---|---|
| Boot fails with “PUBLIC_SALEOR_API_URL is set, but it configures a different backend than the one this build runs on” | The variable is set while a different connector is installed. Install @misiki/saleor-connector, or remove the variable if you meant to run another backend. With more than one connector installed, set PUBLIC_CONNECTOR='@misiki/saleor-connector'. |
| Sign-in or cart works in dev but not when deployed | Almost always CORS: allow the deployed storefront’s origin on the Saleor API. |
Before you rely on it
No connector has been exercised against a live production instance of its platform; each was written from the platform’s published source. The limits every backend shares and the errors every switch can meet are on the backends page.
Offer a sandbox or a correctionFAQ
Questions about Svelte Commerce on Saleor
Can I sell on Saleor with Svelte Commerce today?
Not yet. The coverage script counts cart, checkout and sign-in as not wired, CONNECTORS.md says the Saleor connector predates the current wiring pass, and its own guide says the card gateways throw “not implemented”.
Why does the guide describe a working checkout when the table says it is not wired?
The guide describes what the connector calls; the coverage script counts a service only when it reaches the connector’s own HTTP layer, and does not count cart, checkout or auth. CONNECTORS.md lists Saleor as a next candidate for the source-verification sweep that would settle it.
Which Saleor settings does Svelte Commerce need?
Email confirmation for registration turned off, isPhoneMandatory set to false, unpaid orders allowed in both the order settings and the channel settings, and the storefront’s origin allowed in CORS.
What goes in PUBLIC_SALEOR_API_URL?
The full GraphQL endpoint, such as https://your-store.saleor.cloud/graphql/ — not only the host. It is the one variable the Saleor connector needs.
Sources
SALEOR.md, read on ; CONNECTORS.md, read on ; the connector’s source at 87c3f2e. Where they disagree with this page, they are right. Saleor is a trademark of its owner, named only to describe compatibility; see trademarks.