Shop fronts and domains
A shop can have a public online shop on its own domain. This page says how Tienda knows which shop a visitor is looking at. For the screens, see the manual: Shop front.
What a shop front is
A shop front belongs to one shop (tenant) and has one domain, for example
shop.example.org. A domain is stored in lower case, without a leading www.,
and can belong to only one shop front. A shop front also holds its display name,
its palette, the name of its menu, the webshop on/off switch with a closed
notice per language, and its opening hours for display.
When the webshop switch is off, visitors can still browse. The shop takes no
orders from guests; it answers 422 with webshop_closed. Staff at the register
are not affected.
How the shop is chosen
The public shop is a web application that runs on the shop's own domain and calls Tienda's shared API address. The API address itself says nothing about which shop is meant. Tienda decides in this order:
- It looks at the host the browser says it came from: the
X-Shop-Hostheader if present, and theOriginof the request. If neither is present it uses the host of the request itself. - A shop front whose domain equals that host (ignoring a leading
www.) wins. Its shop is the shop of the request. - If no shop front claims the host, the installation's first shop answers only if the host is on the operator's list of home hosts, or if the installation has exactly one shop.
- Anything else is an unknown shop. Nothing is looked up, and the answer is
404with{"error": "Unknown shop"}.
The shop is never taken from a parameter or from a token in these requests. For
the customer account (/api/v1/storefront/account/...) a token from another shop
is refused with 401.
What a domain needs
- The domain must point at the public shop application. How is part of running Tienda and is arranged by whoever operates it.
- A shop front record with that domain. Settings pages for shop fronts exist in the back office; the manual describes them.
- The domain must be on the list of allowed origins, which Tienda builds from the
shop fronts' domains (
https://<domain>andhttps://www.<domain>). Browser calls from other origins are refused by CORS.