Svelte Commerce × Virto Commerce
Svelte Commerce on Virto Commerce
Targeting Virto Commerce meant choosing which of its API generations to wire against; the connector speaks its GraphQL API. Cart, checkout and sign-in are wired, and CONNECTORS.md records no gaps.
- 28/43 services wired
- @misiki/virto-connector 0.4.0
- Cart wired
- Checkout wired
- Sign-in (auth) wired
What works on Virto Commerce today
Cart, checkout and sign-in are wired, and no gaps are recorded. Orders are placed through the payment methods the Virto store itself exposes; a gateway the store has not configured is refused with a message saying so.
Cart
Wired: issues a real request to Virto Commerce.
Checkout
Wired: issues a real request to Virto Commerce.
Sign-in (auth)
Wired: issues a real request to Virto Commerce.
Known gaps: none recorded.
28 of 43 services wired, read from CONNECTORS.md on , where the package version is recorded too; npm may carry a newer patch. Coverage is traced by a script in the Svelte Commerce repository: a service counts as wired only if it transitively issues an HTTP request, or delegates to one that does. It is not hand-asserted. Some services are Litekart-native concepts with no equivalent elsewhere (reels, deals, chat, gallery, popularity, demo-request, feedback, plugins, banner). They stay documented placeholders on every connector and are excluded from known gaps.
Quick start
From nothing to a Svelte Commerce storefront reading Virto Commerce. You need Node.js and a Virto Commerce to point it at; the storefront holds no data of its own.
Clone it, choose the connector, point it at Virto Commerce
# 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/virto-connector
# 3 — point it at your Virto Commerce platform
echo PUBLIC_VIRTO_COMMERCE_API_URL=https://your-store.example.com >> .env
# 4 — run it
npm run dev The guide removes only @misiki/litekart-connector. A fresh clone’s package.json also lists @misiki/vendure-connector, and with two connectors installed and neither of them Litekart’s, the build stops and asks for PUBLIC_CONNECTOR — so this removes both.
Environment variables
| Variable | Required | What it does |
|---|---|---|
PUBLIC_VIRTO_COMMERCE_API_URL | Yes | Base URL of your Virto Commerce platform. Boot fails, naming this variable, if it is missing. |
PUBLIC_VIRTO_COMMERCE_STORE_ID | No | The Virto store the storefront serves. |
PUBLIC_VIRTO_COMMERCE_CULTURE_NAME | No | Such as en-US. Passed on nearly every catalogue, cart and order query; read once from the store if unset. |
PUBLIC_VIRTO_COMMERCE_CURRENCY_CODE | No | Such as USD. Passed on every priced query; read once from the store if unset. |
PUBLIC_VIRTO_COMMERCE_CATALOG_ID | No | Needed to filter products by category; read once from the store if unset. |
PUBLIC_VIRTO_COMMERCE_ACCESS_TOKEN | No | An access token to start from, sent in the Authorization header. |
PUBLIC_CONNECTOR | No | Only when more than one connector is installed: @misiki/virto-connector names the one this build runs on. |
init.ts hands the connector every PUBLIC_VIRTO_COMMERCE_* variable that is set, camel-cased — the prefix follows the product, not the package, which is virto-connector. The guide also lists PUBLIC_VIRTO_COMMERCE_API_KEY, PUBLIC_VIRTO_COMMERCE_API_SECRET, PUBLIC_VIRTO_COMMERCE_ACCESS_KEY and PUBLIC_VIRTO_COMMERCE_CHANNEL_ID; the connector’s source does not read them.
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 Virto Commerce
- Configure the payment methods you want shoppers to use on the Virto store itself: the connector places orders through
cart.availablePaymentMethods, and refuses a gateway the store does not offer. - Let the storefront’s origin make cross-origin requests to Virto Commerce (CORS): in production the browser calls
PUBLIC_VIRTO_COMMERCE_API_URLdirectly, not only the server.
How the integration works
The connector speaks Virto Commerce’s GraphQL API, which wants culture, currency and catalogue as explicit arguments on most operations. Whatever you leave unset is read once from the store’s own record and remembered. Checkout places the order with a payment method the store exposes, matched by name — or, for cash on delivery, by a manual payment method.
Installing the package is the whole switch. vite.config.ts resolves whichever @misiki/*-connector is installed, and src/lib/core/connectors/init.ts hands it every PUBLIC_VIRTO_COMMERCE_* variable that is set, camel-cased, at boot — in the server hook for server rendering and in the client hook for the browser, which must reach the same URL in production.
There is no Litekart API behind the storefront here, so store identity — name, logo, currency, menus, plugin toggles, theme colours — comes from src/lib/core/connectors/default-store.json merged under the default export of kitcommerce.config.ts. Until you override it, the store is called “Test”. Any Litekart REST path the connector still inherits is answered from that local data, or resolved empty, rather than requested.
Limitations
- No gaps are recorded for Virto Commerce in CONNECTORS.md.
- Homepage sections other than the live product list come from the active theme’s static content — the standing rule for themes.
- The Conversational Shopping assistant is Litekart-only; its widget stays hidden when another connector is active.
Troubleshooting
| When you see | What to do |
|---|---|
| Boot fails with “the virto connector is active but PUBLIC_VIRTO_COMMERCE_API_URL is not set” | Add PUBLIC_VIRTO_COMMERCE_API_URL to .env. A production Node build and Docker read PUBLIC_* from the process environment rather than .env, so set it on your deploy platform too. |
| The build stops with “Several commerce connectors are installed … Set PUBLIC_CONNECTOR to pick one” | More than one @misiki/*-connector is in package.json and none is Litekart’s. Uninstall the ones you do not run — a fresh clone also lists @misiki/vendure-connector — or set PUBLIC_CONNECTOR='@misiki/virto-connector'. |
| Boot fails with “PUBLIC_…_API_URL is set, but it configures a different backend than the one this build runs on” | Another backend’s variable is still set, usually left over from the one you switched from. Remove it, or install that backend’s connector. PUBLIC_LITEKART_API_URL is exempt: it only points the dev proxy. |
| The store is called “Test”, or shows the wrong name and logo | Store identity is static on this backend. Set name, logo, currencyCode and the rest in the default export of kitcommerce.config.ts; src/lib/core/connectors/default-store.json lists every field. |
[virto] no native implementation for get /api/... in the console | The connector’s REST guard caught a path inherited from Litekart and answered it empty instead of requesting it. Each path is reported once. Harmless if Virto Commerce has no such feature; if it has one, the fix belongs in the connector’s matching service. |
http proxy error: api/... ECONNREFUSED in dev | A Litekart REST path was requested from outside the connector, so its guard never saw it. Vite proxies /api to PUBLIC_LITEKART_API_URL, or to localhost:7000. |
The build fails on @misiki/litekart-connector | @misiki/kitcommerce-core declares it as a peer, and vite.config.ts redirects that specifier to whichever connector is installed. Make sure exactly one @misiki/*-connector is listed in package.json. |
Before you rely on it
The one caveat that matters
Read this before choosing
Every connector was written by reading its platform’s authoritative source — an OpenAPI spec, a RAML file, a router registration or the controller source — rather than by running against a store. No connector has been exercised against a live production instance of its platform.
Offer a sandbox or a correctionFAQ
Questions about Svelte Commerce on Virto Commerce
Can I run a Virto Commerce store on Svelte Commerce today?
Cart, checkout and sign-in are wired against Virto’s GraphQL API and no gaps are recorded. Orders go through the payment methods your Virto store exposes. Like every connector, it has not been run against a live production Virto store.
How do I switch Svelte Commerce to Virto Commerce?
Remove the connectors the storefront ships with, install @misiki/virto-connector, set PUBLIC_VIRTO_COMMERCE_API_URL in .env and start the dev server. vite.config.ts resolves whichever connector is installed, so no file in the storefront changes.
Which payment methods can shoppers use on Virto Commerce?
The ones your Virto store exposes through cart.availablePaymentMethods. Cash on delivery maps to a manual payment method; a gateway the store has not configured is refused with a message saying so, rather than faked.
Has the Virto Commerce connector been run against a real Virto Commerce store?
Not against a live production instance — no Svelte Commerce connector has been. It was written by reading Virto Commerce’s authoritative API source, and the Svelte Commerce maintainers ask Virto Commerce’s own maintainers for a sandbox to run it against.
Sources
This page summarises VIRTO-COMMERCE.md in the Svelte Commerce repository and the Virto Commerce connector’s source, read on , and the coverage in CONNECTORS.md, read on . Where they disagree with this page, they are right and this page is out of date. Virto Commerce is a trademark of its owner, named here only to describe compatibility; no endorsement or affiliation is implied — see trademarks.
Read the whole guide
The storefront is the same on every backend; the connector is what changes. VIRTO-COMMERCE.md has the Virto Commerce setup in full, beside the connector’s source.