# Themes Source: https://shopdepot.dev/docs/themes/ A theme is the look of a ShopDepot store: the HTML, CSS and JavaScript of every storefront page. It is a folder of Twig templates, JSON and assets that the platform renders for each request, with the store's data passed in as read-only [objects](../reference/objects/index.md). If you have built a Shopify Online Store 2.0 theme, most of this will feel familiar on purpose: layouts, JSON templates, sections, theme blocks, snippets, `{% schema %}`, `settings_schema.json` and locales work the same way. The templating language is **Twig** instead of Liquid, and it runs in a sandbox. ## What a theme controls - **Page layouts** - the home page, offer pages, categories, content pages, the blog, search, the cart, feature pages (authors, brands) and the 404 page. See [Page types](../reference/page-types.md). - **Sections and blocks** the merchant arranges in the theme editor, with the settings you declare. - **Theme settings** - colours, fonts, logo, layout options - shared by every page. - **Styles of platform components** - the contact form and the cart summary - through stable class names. - **Brand tokens** the platform reuses on its own pages in the store. ## What the platform keeps Some parts of a store are the same in every theme, because they have to work the same way everywhere and stay compliant: | Area | Why the platform owns it | | --- | --- | | Checkout and the thank you page | Payments, consents and order rules. Merchants brand it in their settings. | | Customer accounts, returns and complaints | Personal data and legal deadlines. | | `` metadata - description, canonical, Open Graph, robots | One SEO model per store, set by the merchant. | | The contact form, newsletter sign-up and the cart summary | Consents, validation, rate limits and spam protection. | | Scripts and tracking pixels | Added by the merchant, loaded only with consent. | Your theme inherits all of this. It never has to implement a checkout or a login form, and it cannot break them. The pages the platform renders inside the store still look like your theme: they take colours, radius and fonts from your [brand tokens](platform-pages.md#brand-tokens). ## How a theme gets to a store 1. You build the theme locally, starting from the reference theme `base`. 2. You push it to a development store with the [CLI](cli.md) (or upload a ZIP), and the ShopDepot team publishes it to the theme registry. 3. The merchant installs it from the [theme store](publishing.md) or their library, customizes it in the theme editor and publishes it. Every installation is a copy: the merchant's settings and edits live with their store, and a new version of your theme arrives as an update they accept. ## Where to go next - [Create your first theme](getting-started.md) - [Learn the architecture](architecture.md) - [Browse the reference](../reference/index.md) --- # Create a theme Source: https://shopdepot.dev/docs/themes/getting-started/ This guide takes you from nothing to your own theme running on real store data. You need a code editor, a terminal and a ShopDepot development store. ## 1. Get a development store A development store is a separate ShopDepot account made for building: it has no plan limits, no billing clock, and paid themes are fully editable and publishable there. Development stores are created by the ShopDepot team today - write to us from [shopdepot.pl](https://shopdepot.pl/) and we set one up with sample categories and offers. Self-service partner accounts are on the roadmap. > [!TIP] > Build against data that looks like your target merchants'. A theme tested on three products with one photo each will break on a catalogue with long titles, many variants and no images. ## 2. Install the CLI ```bash curl -fsSL https://shopdepot.dev/install.sh | sh ``` On Windows, download the `.exe` from the [CLI page](cli.md#install). Then create a developer token in the development store (**Sales channels → Stores → your store → Appearance → Themes → Developer access**) and connect: ```bash shopdepot login ``` ## 3. Start from `base` Every ShopDepot theme starts as a copy of **base**, the free reference theme. It covers every page type, uses the conventions the theme store checks for, and is small enough to read in an afternoon. ```bash shopdepot theme init example cd example ``` `init` downloads base into a new folder and gives the copy its own identity: the `handle` becomes `example` and the version `0.1.0`. Fill in the rest of `theme.json` - the `handle` identifies your theme in the registry and cannot be changed later: ```json { "name": "Example", "handle": "example", "version": "0.1.0", "author": "Example Studio", "description": "A calm theme for small catalogues." } ``` See [theme.json](theme-json.md) for every key. ## 4. Look around ```text example/ ├── theme.json the manifest ├── layout/theme.twig the HTML shell of every page ├── templates/*.json which sections each page type shows ├── sections/ sections, in folders if you like ├── blocks/ theme blocks the merchant can nest ├── snippets/ partials for developers ├── assets/ CSS, JavaScript, fonts, images ├── config/ the theme settings schema and starting values └── locales/ storefront texts in each language ``` Open `templates/product.json` and follow it: it names the `main-product` section, which renders blocks like `price` and `buy-buttons`, which call snippets like `product-card`. That path - **template → section → block → snippet** - is the whole architecture. [Architecture](architecture.md) explains it properly. ## 5. Push and preview Upload the folder as a new draft theme, then start the development loop: ```bash shopdepot theme push --new shopdepot theme dev ``` `dev` prints a preview link and uploads every file as you save it. Open the link: it shows your theme on the store's real data without publishing it. Change a colour in `assets/css/base.css` or a line in `sections/content/hero.twig`, save, refresh. A file the platform refuses - a Twig syntax error, a filter the [sandbox](twig-sandbox.md) does not allow, a path outside the [file contract](file-structure.md) - is reported in the terminal with the reason and is not saved, so the preview keeps working on the previous version. In the admin, under **Appearance → Themes**, the theme is in the library as a draft. From there you can also **Customize** it in the theme editor, exactly as a merchant would, and **Publish** it to make it the live theme of the development store. ## 6. Check and package Before you show the theme to anyone, run the checks and build the package: ```bash shopdepot theme check shopdepot theme package ``` `check` runs every file through the platform's rules and points out common mistakes. `package` writes `example-0.1.0.zip` with exactly the files the platform accepts. Bump `version` in `theme.json` before each package you hand over - versions are never overwritten. > [!NOTE] > You can still work without the CLI: zip the folder with `theme.json` at the top and use **Appearance → Themes → Upload your own theme** in the admin. The upload screen lists every file the contract left out - check it, because a missing font or image shows up later as a 404. ## 7. Keep going - Read [Sections and blocks](sections-and-blocks.md) before you add your first section. - Keep the [Twig sandbox rules](twig-sandbox.md) in mind - templates that break them do not save. - Every command and option: [ShopDepot CLI](cli.md). - Run through the [review checklist](checklist.md) before you submit the theme. --- # Using AI assistants Source: https://shopdepot.dev/docs/themes/ai-assistants/ AI assistants write good ShopDepot themes when they work from this documentation, and bad ones when they guess from Shopify or plain Twig. Give them the docs. ## Connect the MCP server ShopDepot runs a [Model Context Protocol](https://modelcontextprotocol.io/) server for theme development at: ```text https://shopdepot.dev/mcp ``` It is public: no account, no token, no installation. Once it is connected, your assistant can search and read these docs, look up the exact reference entry for an object, filter, function or tag, and check theme files against the same rules the platform applies when it saves a file. It does not read or change any store. | Tool | What the assistant uses it for | | --- | --- | | `search_docs` | Find the guide or reference page for a task. | | `get_doc` | Read a page as Markdown (`index` lists every page). | | `lookup_reference` | The exact entry for `product`, `image_url`, `cart_summary`, `schema`... If it is not there, the sandbox refuses it. | | `validate_theme_files` | Check changed files: the file contract, JSON and `{% schema %}`, Twig syntax and the sandbox, plus common mistakes. Nothing is saved. | The server also gives the assistant a short set of rules when it connects, so it works from the docs instead of guessing from Shopify or plain Twig. **Claude Code** ```bash claude mcp add --transport http shopdepot https://shopdepot.dev/mcp ``` **Claude (desktop and web)** - open **Settings → Connectors → Add custom connector**, name it ShopDepot and paste the address. **Cursor** - `.cursor/mcp.json` in the theme folder (or `~/.cursor/mcp.json` for every project): ```json { "mcpServers": { "shopdepot": { "url": "https://shopdepot.dev/mcp" } } } ``` **VS Code** - `.vscode/mcp.json`: ```json { "servers": { "shopdepot": { "type": "http", "url": "https://shopdepot.dev/mcp" } } } ``` **Other clients** - any client that supports the Streamable HTTP transport takes the address as it is. A client that only starts local servers can reach it through a bridge, for example `npx mcp-remote https://shopdepot.dev/mcp`. > [!TIP] > Ask the assistant to call `validate_theme_files` after every change and fix each error before it moves on. Pass `theme.json` along with the files to run the whole-theme checks as well. ## Plain Markdown for every page - Add `.md` to any page address for its Markdown source - this page is [`/docs/themes/ai-assistants.md`](/docs/themes/ai-assistants.md). - Every page has **Copy page as Markdown** at the top - paste it into a chat. - [`/llms.txt`](/llms.txt) lists every page with a one-line description, in the [llms.txt](https://llmstxt.org/) format. - [`/llms-full.txt`](/llms-full.txt) is the whole documentation in one file, for assistants with a large context. The reference pages are generated from the platform code, so an assistant reading them sees exactly which objects, filters and functions exist. ## Tell your assistant the rules Paste this at the start of a session, or put it in your project's instruction file (`CLAUDE.md`, `AGENTS.md`, `.cursorrules`): ```text This is a ShopDepot storefront theme. Documentation: https://shopdepot.dev/llms.txt Rules: - Templates are Twig in a sandbox. Use only the tags, filters and functions listed at https://shopdepot.dev/docs/reference/filters.md, /functions.md and /tags.md. No extends, macro, import or block. Reuse markup with render('snippet-name', {...}). - Read data only from objects (https://shopdepot.dev/docs/reference/objects.md). Property names are camelCase: product.featuredMedia, not product.featured_media. - Prices are integers in minor units. Always format with |money. - Files: lowercase paths, at most 4 levels deep, sections/blocks/snippets referenced by file name only. Blocks need {% schema %}, snippets must not have one. - Pages are cached and shared by all visitors: never print customer or cart data in sections. Read the cart with fetch('/cart.js'). - Store addresses end with a trailing slash: /cart/, /products/example/. - The platform writes and meta tags in content_for_header - do not add your own description, canonical or Open Graph tags. - The first visible image needs loading: 'eager' or fetchpriority="high"; every other image is lazy automatically. ``` ## Let the assistant check its own work An assistant that edits a theme in your folder can verify what it wrote with the [CLI](cli.md), using the same rules the platform applies on save: ```bash shopdepot theme check ``` Ask it to run `check` after every change and fix each error before it moves on. With `shopdepot theme dev` running in another terminal, every file it saves goes to your development store, and a file the platform refuses is reported with the reason instead of being saved. --- # ShopDepot CLI Source: https://shopdepot.dev/docs/themes/cli/ `shopdepot` is the command line tool for theme developers. It starts a theme from the reference theme, keeps a folder on your computer in sync with a theme in a store, shows you a live preview while you edit and checks the theme against the same rules the platform applies when it saves a file. It is a single file with no dependencies. It talks to the [theme API](theme-api.md) with a developer token, so it never needs your admin password. ## Install On macOS and Linux: ```bash curl -fsSL https://shopdepot.dev/install.sh | sh ``` The script picks the build for your system, checks it against the published SHA-256 checksum and installs it to `~/.local/bin/shopdepot`. Set `SHOPDEPOT_INSTALL_DIR` to install somewhere else. If `~/.local/bin` is not on your `PATH`, the script prints the line to add to your shell profile. On Windows, download [shopdepot-windows-amd64.exe](/cli/shopdepot-windows-amd64.exe), rename it to `shopdepot.exe` and put it in a folder on your `PATH`. All builds and their checksums: | System | File | | --- | --- | | macOS, Apple silicon | [shopdepot-darwin-arm64](/cli/shopdepot-darwin-arm64) | | macOS, Intel | [shopdepot-darwin-amd64](/cli/shopdepot-darwin-amd64) | | Linux, x86-64 | [shopdepot-linux-amd64](/cli/shopdepot-linux-amd64) | | Linux, ARM64 | [shopdepot-linux-arm64](/cli/shopdepot-linux-arm64) | | Windows, x86-64 | [shopdepot-windows-amd64.exe](/cli/shopdepot-windows-amd64.exe) | | Checksums | [SHA256SUMS](/cli/SHA256SUMS) | Check the installation: ```bash shopdepot version ``` To update, run the install command again. ## Connect a store Each store you work on needs a **developer token**. In the store admin open **Sales channels → Stores → your store → Appearance → Themes → Developer access**, give the token a name (your name, or the laptop it lives on) and create it. The token starts with `sdt_` and is shown **once** - copy it straight away. ```bash shopdepot login ``` Paste the token when asked. The CLI checks it with the store, saves it under the store's handle and makes it the default store if it is your first one. You can pass everything at once: ```bash shopdepot login --token sdt_... --store example ``` A token gives access to the themes of **one store** and nothing else: no orders, customers or settings. Revoke it on the same screen at any time - tools using it lose access at once. A store can have up to 20 tokens; create one per person and per machine, so that revoking one does not lock everybody out. > [!TIP] > Work in a **development store**. There, paid themes are editable and publishable, and nothing you push reaches real customers. In a live store, a paid theme on trial is read-only and `push` refuses it. | Command | What it does | | --- | --- | | `shopdepot login [--store NAME] [--token sdt_...]` | Save a token. `NAME` defaults to the store handle. | | `shopdepot stores` | List saved stores; the default is marked. | | `shopdepot logout [--store NAME]` | Forget a saved token (revoke it in the admin too). | Tokens are saved in your user configuration folder (`~/.config/shopdepot/config.json` on Linux, `~/Library/Application Support/shopdepot/config.json` on macOS, `%AppData%\shopdepot\config.json` on Windows), readable only by you. `SHOPDEPOT_CONFIG` points the CLI at another file. ## Start a theme ```bash shopdepot theme init example cd example ``` `init` downloads the current version of **base**, the free reference theme, into a new folder and renames it after the folder: `handle` becomes `example`, the version resets to `0.1.0` and the author is cleared. Fill in `name`, `author` and `description` in [theme.json](theme-json.md) - the `handle` identifies the theme in the registry and cannot change later. `init` also writes: - `.shopdepot.json` - which store and theme this folder belongs to (keep it out of git; `init` adds it to `.gitignore`), - `.shopdepotignore` - patterns of files that never go to the store. Upload the folder as a new theme: ```bash shopdepot theme push --new ``` The theme is added to the store's library as a **draft** and the folder remembers it, so later commands need no `--theme`. The command prints a preview link. ## The development loop ```bash shopdepot theme dev ``` `dev` first uploads anything that differs from the store, then watches the folder. Every file you save goes up within about a second, every file you delete is removed from the theme, and each change is printed with a mark: ```text Watching /home/you/example → "Example" Preview: https://example.myshopdepot.pl/?preview_theme=... Press Ctrl+C to stop. 14:02:11 ✓ sections/content/hero.twig 14:02:19 ! sections/content/hero.twig: Unexpected "}" (line 12) 14:02:25 ✓ sections/content/hero.twig 14:03:40 ✗ snippets/old-card.twig ``` A file the platform refuses (a Twig syntax error, a filter the [sandbox](twig-sandbox.md) does not allow, a path outside the [file contract](file-structure.md)) is marked `!` with the reason and **not saved** - the theme keeps the previous version, so the preview never shows a broken page. Fix the file and save again. Open the preview link and refresh after a change. The link shows your theme on the store's real data without publishing it, for you and anyone you send it to, and stays active in that browser for a day. Add `?preview_theme=off` to any store address to leave the preview. `--interval 1s` changes how often the folder is checked (the default is 500 ms). ## Commands Every theme command accepts `--store NAME` (default: the store the folder belongs to, then the default store) and `--path DIR` (default: the current folder). `--theme ID` selects a theme by the id `theme list` prints; without it, the folder's theme is used. | Command | What it does | | --- | --- | | `shopdepot theme init [DIR]` | Start a theme from `base` in a new folder (default `example-theme`). | | `shopdepot theme list` | Themes installed in the store: id, name, role (live or draft), licence and whether you can edit them. | | `shopdepot theme pull [--theme ID] [--only GLOB]` | Download a theme into the folder. Only changed files are written. | | `shopdepot theme push [--theme ID] [--only GLOB] [--nodelete] [--dry-run] [--publish]` | Upload local changes. | | `shopdepot theme push --new [--publish]` | Upload the folder as a new draft theme and link the folder to it. | | `shopdepot theme dev [--theme ID] [--interval 500ms]` | Push every change as you save and print the preview link. | | `shopdepot theme check [--strict]` | Check the theme against the platform rules without changing the store. | | `shopdepot theme open [--theme ID] [--page /products/example/]` | Open the preview in your browser. | | `shopdepot theme package [--out FILE]` | Build the ZIP you upload in the admin or submit to the theme store. | ### push `push` compares checksums and uploads only what changed. Files that are in the theme but not in your folder are **deleted** from the theme, so the store ends up exactly like the folder; `--nodelete` keeps them. Use `--dry-run` to see the plan first: ```bash shopdepot theme push --dry-run ``` `--only` limits a push or pull to matching paths and can be repeated: ```bash shopdepot theme push --only 'sections/*' --only 'assets/css/base.css' ``` `--publish` makes the theme live after the push. In a store with customers, prefer publishing from the admin, where you see the theme next to the live one. `push` never overwrites `config/settings_data.json` in the store, because it holds the values set in the theme editor. To replace them with your file on purpose, name it: ```bash shopdepot theme push --only config/settings_data.json ``` (`dev` does upload it when you edit and save it, since that is a deliberate change.) Pull before you push when someone else, or the merchant in the theme editor, may have changed the theme: `templates/*.json` change too every time the theme is customized in the editor. ### check ```bash shopdepot theme check ``` `check` sends the folder to the platform and runs every file through the same rules as a save: the [file contract](file-structure.md), JSON and `{% schema %}` syntax, Twig syntax and the [sandbox](twig-sandbox.md). It also reports problems that are allowed but usually a mistake: - `layout/theme.twig` missing `{{ content_for_header }}` or `{{ content_for_layout }}`, or writing its own description, canonical or Open Graph tags, - a missing `snippets/brand-tokens.twig` or a missing template for a page type, - a section or block whose root element does not print `section.attributes` / `block.attributes`, - files outside the contract, which would be skipped silently on upload. Errors make the command exit with status 1; `--strict` does the same for warnings, which is what you want in continuous integration: ```yaml # .gitlab-ci.yml or any CI theme-check: script: - curl -fsSL https://shopdepot.dev/install.sh | sh - ~/.local/bin/shopdepot theme check --strict variables: SHOPDEPOT_TOKEN: $SHOPDEPOT_TOKEN ``` `check` reads the store only to run the rules - it never changes a theme. ### package ```bash shopdepot theme package ``` Writes `<handle>-<version>.zip` with exactly the files the platform accepts, `theme.json` at the top of the archive. Bump `version` in `theme.json` before every package you hand over: versions in the registry are never overwritten. See [Publishing](publishing.md). ## Ignored files These never go to the store and are never deleted from it by `push`: `.git`, `node_modules`, `.DS_Store`, `.shopdepot.json`, and the `demo/` folder (demo store data ships in the package, not in a store's theme). Add your own patterns to `.shopdepotignore`, one per line: ```text # source files compiled into assets/ src/ *.map assets/*.scss ``` A pattern without `/` matches a name at any depth; a pattern with `/` matches from the theme root; a trailing `/` matches a folder. ## Automation and CI `SHOPDEPOT_TOKEN` (and optionally `SHOPDEPOT_API`) override the saved stores, so a pipeline needs no `login`: ```bash SHOPDEPOT_TOKEN=sdt_... shopdepot theme push --theme 0193d7a2-... --nodelete ``` Keep the token in your CI's secret variables, never in the repository. Create a separate token for CI so you can revoke it without touching your own. ## Troubleshooting | Message | What to do | | --- | --- | | `Missing or invalid token` | The token was revoked or mistyped. Create a new one and run `shopdepot login` again. | | `"Example" is read-only in this store (licence: trial)` | A paid theme on trial cannot be changed. Buy it in the store, or work in a development store. | | `outside the theme file contract` | Rename the file: lowercase letters, at most four folders deep, inside one of the theme folders. See [File structure](file-structure.md). | | `Unexpected ... (line 12)` | A Twig syntax error. The file was not saved; the store still has the previous version. | | `Filter "..." is not allowed` (or tag, function, method) | The template uses a tag, filter, function or method themes cannot call. See [The Twig sandbox](twig-sandbox.md). | | `no theme.json in this folder` | Run the command inside the theme folder, or pass `--path`. | --- # Theme API Source: https://shopdepot.dev/docs/themes/theme-api/ The theme API is what the [ShopDepot CLI](cli.md) uses. Use it directly when you build your own tooling: an editor plugin, a deploy script, a build step that uploads compiled assets. ```text https://hooks.shopdepot.pl/theme-api/v1 ``` Every request and every response is JSON unless noted otherwise. The API works on the themes of **one store** - the store the token belongs to. ## Authentication Create a developer token in the store admin: **Sales channels → Stores → your store → Appearance → Themes → Developer access**. Send it in the `Authorization` header: ```bash curl https://hooks.shopdepot.pl/theme-api/v1/store \ -H "Authorization: Bearer sdt_..." ``` The token is shown once and stored only as a hash. It reads and writes themes of its store and nothing else. Revoking it in the admin takes effect on the next request. A missing, mistyped or revoked token answers `401`. ## Errors Errors are JSON with a message for a human and, for file operations, the path: ```json { "error": "Unexpected \"}\" (line 12)", "path": "sections/content/hero.twig" } ``` | Status | Meaning | | --- | --- | | `401` | No token, or the token is invalid or revoked. | | `403` | The theme cannot be changed or published: a paid theme on trial, or a licence that does not allow it. | | `404` | No such theme in this store, or no such file. | | `422` | The request was refused by a platform rule. The file or theme did not change. | ## Store ### `GET /store` The store of the token and its themes. Use it to check a token. ```json { "store": { "name": "Example", "handle": "example", "url": "https://example.myshopdepot.pl/", "locale": "pl", "currency": "PLN" }, "token": { "name": "Laptop" }, "themes": [ { "id": "0193d7a2-...", "name": "Example", "role": "unpublished" } ] } ``` ## Themes ### `GET /themes` ```json { "themes": [ THEME, ... ] } ``` A theme object: | Key | Description | | --- | --- | | `id` | Theme id - use it in every theme address. | | `name` | Name in the library. | | `role` | `published` for the live theme, `unpublished` or `development` for the others. | | `package` | `{ "handle", "version" }` of the registry package it was installed from, or `null`. | | `license` | Licence state of a paid theme in this store: `not_required` (free theme), `trial`, `active` (bought), `expired` (live, no more updates) or `development` (development store). | | `editable` | Whether files can be written. `false` for a paid theme on trial. | | `publishable` | Whether the theme can be published. | | `managed_by` | The tool that keeps the theme's code outside the store (for example `studio`), or `null`. See [`PATCH /themes/{id}`](#patch-themesid). | | `available_update` | A newer published version of `package`, or `null`. For a theme with `managed_by` it is only information: the store never applies it. | | `updated_at` | Last change, ISO 8601. | | `preview_url` | A link that shows this theme on the store's data without publishing it. | ### `GET /themes/{id}` The theme and its files, sorted by path: ```json { "theme": THEME, "files": [ { "path": "assets/css/base.css", "checksum": "9f2c...", "size": 18213, "binary": false, "updated_at": "2026-11-15T14:02:11+01:00" } ] } ``` `checksum` is the SHA-256 of the file's bytes. Compare it with the SHA-256 of your local file to know what changed - that is how `shopdepot theme push` uploads only differences. ### `POST /themes` Creates a theme in the store's library, always as a draft. Two forms: Upload a ZIP (`multipart/form-data`, field `archive`, at most 50 MB): ```bash curl https://hooks.shopdepot.pl/theme-api/v1/themes \ -H "Authorization: Bearer sdt_..." \ -F archive=@example-0.1.0.zip ``` The archive becomes a private package of the store's account (only this account can install it) and is installed. `theme.json` must be at the top of the archive or inside one top-level folder, and its `version` must be new - versions are never overwritten. The response lists files the platform left out because they break the [file contract](file-structure.md): ```json { "theme": THEME, "skipped": ["assets/Fonts/Mono.woff2"] } ``` Copy a theme of this store: ```json { "duplicate": "0193d7a2-...", "name": "Example - experiment" } ``` Both answer `201`. Add `managed_by` (a JSON key, or a form field next to `archive`) to create the theme as managed outside the store from the start. ### `PATCH /themes/{id}` Says who keeps the theme's code: ```json { "managed_by": "studio" } ``` Use it when the theme's code lives in a repository and is sent with this API. Package files then never land on the theme by themselves: the nightly update skips it, the library shows no **Update** button and the theme cannot be reset to the package version. A newer package version still shows in `available_update`, so your tool can propose the update as a change in the repository. `managed_by` is lowercase letters, digits and `-`, at most 40 characters. `{ "managed_by": null }` hands the theme back to the store - the merchant can also do it with **Detach from Studio** in the library. Answers `200` with `{ "theme": THEME }`. ### `POST /themes/{id}/publish` Makes the theme live. `403` when the licence does not allow it. ### `GET /themes/{id}/preview?path=/products/example/` ```json { "url": "https://example.myshopdepot.pl/products/example/?preview_theme=..." } ``` Opening the link shows the theme to that browser for a day. `?preview_theme=off` ends the preview. ## Files Paths are theme paths as in the [file structure](file-structure.md), for example `sections/content/hero.twig`, without a leading slash. ### `GET /themes/{id}/files/{path}` The file itself: text as `text/plain; charset=UTF-8`, images and fonts as bytes. The `X-Checksum` header carries the SHA-256. ### `PUT /themes/{id}/files/{path}` The request body is the new content: UTF-8 text, or bytes for an image or font in `assets/`. Creates the file or replaces it. ```bash curl -X PUT https://hooks.shopdepot.pl/theme-api/v1/themes/0193d7a2-.../files/sections/content/hero.twig \ -H "Authorization: Bearer sdt_..." \ --data-binary @sections/content/hero.twig ``` ```json { "path": "sections/content/hero.twig", "checksum": "9f2c...", "size": 1264 } ``` A write goes through the same rules as the code editor in the admin, and a refused file is **not saved**: - the [file contract](file-structure.md) - path, kind, size, - JSON syntax, and the `{% schema %}` of sections and blocks, - Twig syntax and the [sandbox](twig-sandbox.md): tags, filters, functions and methods a theme may use. Every write keeps the previous version of the file with `CLI: <token name>` as the author, so the code editor in the admin can restore it. Writing `config/settings_data.json` also applies its `current` object to the theme's settings in the store - colours, fonts, widths, everything the theme editor sets. Those values live on the theme, not in the file, so this is how a file you send on purpose shows up on the storefront. Keys missing from your file keep their values. The response then has `settings_applied`, the list of settings that changed. ### `DELETE /themes/{id}/files/{path}` ```json { "deleted": "snippets/old-card.twig" } ``` `theme.json` and `layout/theme.twig` cannot be deleted (`422`). ## Check ### `POST /check` Runs a whole theme through the save rules without touching any theme in the store, plus checks for common mistakes (missing `content_for_header`, missing brand tokens, sections without `section.attributes`). This is `shopdepot theme check`. ```json { "files": { "theme.json": "{ ... }", "layout/theme.twig": "<!doctype html> ..." }, "binaries": { "assets/fonts/body.woff2": 48211 } } ``` `files` holds text files with their content; `binaries` holds paths and sizes of images and fonts (their content is not needed). ```json { "errors": 1, "warnings": 1, "problems": [ { "path": "sections/content/hero.twig", "level": "error", "message": "Unexpected \"}\" (line 12)" }, { "path": "sections/content/hero.twig", "level": "warning", "message": "the root element does not print {{ section.attributes }} - the theme editor cannot select the section." } ] } ``` ## Building a theme from the store's data These calls help a tool (ShopDepot Studio, your own scripts) map an existing site onto sections and fill them with the store's real data. ### `GET /themes/{id}/sections` Every section and block that can be placed in this theme: the platform's core sections plus the theme's own files. Each entry has `key` (`sections/faq`), `kind` (`sections` or `blocks`), `type`, `name`, `source` (`core` or `theme`), `doc`, `settings` (`id:type`), `blocks`, `presets` and `targets`. A theme file with the same name as a core section replaces it and has `overrides_core: true`. ### `GET /sample` A small sample of the store's data to wire sections to: `categories` (`handle`, `name`, `depth`, `url` and what the merchant set for the category - see below), `menus` (`handle`, `name`) and published `offers` (`handle`, `title`, `url`), plus `category_count` and `offer_count`. No customers, orders or purchase prices. Each category also says what it has, so you can pick one to check a banner, an icon or the text below the products: ```json { "handle": "serums", "name": "Serums", "depth": 1, "url": "https://example.myshopdepot.pl/categories/serums/", "heading": "Face serums", "image": "https://cdn.example/m/…/serums_480.webp", "icon": null, "icon_vector": false, "has_description": true, "has_additional_description": false } ``` `heading` is the H1 set in the admin (null when the page uses the name), `image` a 480 px thumbnail of the category image, `icon` the icon (`icon_vector` for an SVG), `has_description` and `has_additional_description` whether there is text. In templates the same data is [`category`](../reference/objects/category.md). ### `POST /media` Uploads a file to the store's file library - a multipart request with the file in a field named `file`. Use it for videos, large photos and banners: a theme's `assets/` folder accepts only images and fonts up to 2 MB. The same rules apply as for uploads in the admin (file types, size limits, SVG cleaned or refused, the same file uploaded twice is stored once). Answers `201`: ```json { "media": { "id": "…", "kind": "video", "mime": "video/mp4", "name": "hero.mp4", "url": "https://cdn.…/hero.mp4" } } ``` Point a `video` or `image_picker` setting of a section at the file with its `id`. ## Reference theme ### `GET /starter.zip` The latest published version of `base`, the reference theme, as a ZIP. The `X-Theme-Version` header carries its version. `shopdepot theme init` starts from it. --- # Theme architecture Source: https://shopdepot.dev/docs/themes/architecture/ A storefront page is built in layers. Each layer has one job, and the merchant controls the parts in the middle. ```text layout/theme.twig the HTML shell: <head>, header group, footer group └─ templates/product.json which sections the offer page shows, in what order └─ sections/…/main-product a band of the page, with settings └─ blocks/…/price a piece inside a section, can nest other blocks └─ snippets/… a partial the developer calls with render() ``` ## Layout `layout/theme.twig` is the document around every page. It prints two things the platform prepares: - `{{ content_for_header }}` inside `<head>` - meta tags, canonical, Open Graph, the theme's section stylesheet, preconnects and the scripts the merchant added. Always print it. - `{{ content_for_layout }}` where the page content goes - the rendered sections of the template. Around them the layout renders section groups - `{{ sections('header-group') }}` and `{{ sections('footer-group') }}` - so the merchant edits the header and footer in the editor like any other section. ```twig <!doctype html> <html lang="{{ shop.locale }}"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>{{ page_title ? page_title ~ ' - ' ~ shop.name : shop.name }} {{ 'css/theme.css'|asset_url|stylesheet_tag }} {{ render('brand-tokens') }} {{ content_for_header }} {{ sections('header-group') }}
{{ content_for_layout }}
{{ sections('footer-group') }} {{ 'js/theme.js'|asset_url|script_tag }} ``` The platform replaces your `` with the title from the store's SEO settings, so write a sensible fallback and do not worry about it further. See [SEO](seo.md). ## Templates A template is JSON: a list of sections with their settings and blocks, and their order. There is no Twig in `templates/`. ```json { "sections": { "main": { "type": "main-product", "settings": { "sticky_info": true } }, "related": { "type": "featured-products", "settings": { "heading": "You may also like" } } }, "order": ["main", "related"] } ``` The file in your theme is the **starting point**. When a merchant rearranges sections in the editor, their version is stored with their store and wins over yours. See [Templates](templates.md). ## Sections A section is a horizontal band of a page - a hero, a product grid, the main product area. It is a Twig file with a `{% schema %}` that declares its name, settings and the blocks it accepts. The merchant adds sections to templates, reorders them and fills their settings. ## Blocks A block is a piece inside a section - a heading, a price, a button, a tile. Theme blocks live in `blocks/`, have their own schema and can contain other blocks, so a merchant can build `Group → Columns → Text + Button` without you writing that combination. A section renders its blocks with `{{ content_for('blocks') }}`. ## Snippets A snippet is a partial for you, not for the merchant - a product card, an icon, a price line. It has no schema and the merchant never sees it. Call it with `{{ render('product-card', { product: item }) }}`; it sees only what you pass plus `shop`, `settings` and `cart`. > [!NOTE] > **Block or snippet?** If the merchant should add, remove or configure it, it is a block. If it is a building piece of your own markup, it is a snippet. The schema decides: a block **must** have one, a snippet **must not** - files that break this do not save. ## The core library The platform ships a library of sections and blocks to **every** theme - `product-list`, `faq`, `newsletter`, `testimonials`, `heading`, `paragraph` and more. They style themselves with your [brand tokens](platform-pages.md#brand-tokens), so they fit your theme out of the box, and you can replace any of them by shipping a file with the same name. See [Core sections and blocks](../reference/core-sections.md). ## Data Templates never see the database. The controller of each page hands over [objects](../reference/objects/index.md) - `product`, `category`, `cart` - and the sandbox lets a template read their fields and call a few functions, nothing else. Each page type gets its own variables; see [Page types](../reference/page-types.md). ## Rendering and caching Pages are rendered on the server and cached as finished HTML, shared by every visitor of the store, and each section is cached as a fragment. Your markup must therefore be **the same for everyone**: nothing about the visitor, their cart or their session. Anything personal is read in the browser from the JSON APIs. [Performance and caching](performance.md) covers the rules. --- # File structure Source: https://shopdepot.dev/docs/themes/file-structure/ A theme is one folder. The same paths are used everywhere - in your repository, in the ZIP, in the code editor in the store admin and in the store's database - so a file has one identity from your editor to production. ```text example/ ├── theme.json the manifest (name, handle, version, listing, menus, widgets) ├── layout/ │ └── theme.twig the HTML shell of every page ├── templates/ JSON only - which sections each page shows │ ├── index.json product.json category.json page.json blog.json article.json │ ├── search.json cart.json contact.json terms.json term.json 404.json │ ├── product.mask.json an alternate template (after the dot) │ └── category.books.json an alternate category template ├── sections/ Twig + {% schema %}, folders allowed │ ├── header-group.json section groups sit at the top of sections/ │ ├── footer-group.json │ ├── layout/ header.twig footer.twig announcement-bar.twig │ ├── product/ main-product.twig product-reviews.twig │ └── content/ hero.twig featured-products.twig ├── blocks/ theme blocks: {% schema %} required │ ├── shared/_group.twig a leading underscore marks a system block │ └── product/ price.twig buy-buttons.twig variant-picker.twig ├── snippets/ partials: {% doc %}, no schema │ └── product-card.twig icon.twig brand-tokens.twig ├── assets/ CSS, JS, fonts, images - folders allowed │ ├── css/ js/ fonts/ img/ ├── config/ │ ├── settings_schema.json theme settings (or config/settings/*.json) │ └── settings_data.json starting values of those settings ├── locales/ │ ├── en.default.json storefront texts, the fallback language │ └── pl.json └── demo/ data of the theme's demo store (theme store only) ``` ## The rules Every file is checked when it is written - by an upload, the code editor or a package publish. A rule that fails stops the save with a message; nothing is checked later at render time. | Rule | What it means | | --- | --- | | **Ten names** | Only `theme.json`, `layout/`, `templates/`, `sections/`, `blocks/`, `snippets/`, `assets/`, `config/`, `locales/` and `demo/` are part of a theme. Everything else in your folder - `README.md`, `package.json`, `src/`, `node_modules/` - stays local and is skipped by an upload. Build tools write their output to `assets/`. | | **Lowercase paths** | Letters `a-z`, digits, `.`, `_` and `-`. A file name may start with `_`, a folder may not. | | **Four levels at most** | `assets/img/icons/cart.svg` is fine, `assets/img/icons/ui/cart.svg` is not. | | **Names, not paths** | Sections, blocks and snippets are referenced by file name without folder or extension - `"type": "main-product"`, `render('product-card')`. Folders are for you; move a file between them and nothing breaks. | | **Unique names** | Because of that, a section, block or snippet name must be unique across the whole theme. Two `card.twig` in different folders is an error - name them by domain: `product-card`, `article-card`. | | **Blocks have schemas, snippets do not** | A file in `blocks/` must declare `{% schema %}`. A file in `snippets/` must not. | | **Templates are JSON** | `templates/` and `sections/*-group.json` hold JSON only. | | **Valid JSON** | Templates, section groups, `config/*`, `locales/*`, `theme.json` and `demo/*.json` must parse. | | **Size** | 256 KB per text file, 2 MB per binary file. | | **Binaries in assets** | Images and fonts (`png`, `jpg`, `jpeg`, `gif`, `webp`, `avif`, `ico`, `woff`, `woff2`, `ttf`, `otf`, `eot`) only under `assets/` or `demo/assets/`. SVG is text and may sit anywhere in `assets/`. | > [!WARNING] > An upload does not fail on a file outside the contract - it **skips** it and lists it. A font in `assets/Fonts/` or an image four folders deep silently goes missing and returns 404 in the store. Read the list after every upload. ## Naming conventions The platform does not enforce these, but the theme store review does: - English file names in kebab-case. - `main-*` for the section that renders the main object of a page: `main-product`, `main-category`, `main-cart`. - A leading underscore for system blocks the merchant does not add on their own: `_group`. - Snippets named by what they show: `product-card`, `cart-line`, `price`. ## Settings split across files A long settings schema can be split: instead of `config/settings_schema.json`, put one group per file in `config/settings/` - `10-colors.json`, `20-typography.json`. Files are merged in name order, hence the numeric prefixes. Use one form or the other, not both. ## `settings_data.json` is a starting point `config/settings_data.json` in your package holds the values a store starts with when it installs your theme. After that the merchant's values live with their store: a new version of your theme keeps every value they set, adds new settings with your defaults and parks removed ones, so a rollback can bring them back. See [Settings](settings.md#updates). --- # theme.json Source: https://shopdepot.dev/docs/themes/theme-json/ `theme.json` at the top of the theme says what the theme is. The theme store reads its listing and price from here, and installing the theme creates the menus and widgets it declares. ```json { "name": "Example", "handle": "example", "version": "1.4.0", "author": "Example Studio", "license": "Commercial", "description": "A calm theme for small catalogues.", "summary": "Calm and fast, for stores with up to a few hundred products.", "categories": ["home", "minimal"], "preview": { "background": "#faf6f1", "accent": "#b4543a", "text": "#231b16" }, "catalog": { "tagline": "A calm storefront that lets the products talk", "highlights": ["Mega menu with featured product", "Sticky add to cart", "Two-column product page"], "docs_url": "https://example.com/docs", "support_url": "https://example.com/support" }, "pricing": { "model": "one_time", "amount": 24900, "currency": "PLN" }, "requires": { "shopdepot": ">=1.0" }, "menus": { }, "widgets": { } } ``` ## Identity | Key | Required | Description | | --- | --- | --- | | `name` | yes | Display name. | | `handle` | yes | Lowercase letters, digits and dashes, up to 63 characters. Identifies the theme in the registry for good - choose it once. | | `version` | yes | A semantic version (`1.4.0`). Every upload needs a new one; a version is never overwritten. | | `author` | | Your name or studio. | | `license` | | `MIT`, `Commercial` or another identifier. | | `description` | | One or two sentences for the theme library. | | `summary` | | A shorter line for the catalogue card. | | `categories` | | Catalogue categories, for filtering. | | `preview` | | Three colours - `background`, `accent`, `text` - for the catalogue tile when there is no screenshot. | | `requires.shopdepot` | | The platform version range the theme needs. | ## Catalogue listing `catalog` is the theme store page. It travels **inside the package** on purpose: the store shows what the version you uploaded says, and changing the listing means uploading a new version. Screenshots are the one exception - they are files, uploaded to the listing separately. | Key | Description | | --- | --- | | `tagline` | One sentence under the name. | | `highlights` | Five or six short lines - what the theme does well. | | `screenshots` | Screenshot addresses. Usually left out - screenshots are uploaded to the listing by the theme store team. | | `demo` | Handle of the theme's demo store, when it differs from the theme handle - see [Publishing](publishing.md#demo-store). | | `docs_url` | Your documentation for merchants. | | `support_url` | Where merchants get help. | ## Pricing | Key | Description | | --- | --- | | `model` | `free`, `one_time` or `subscription`. | | `amount` | Price in minor units - `24900` is 249.00. | | `currency` | ISO code, for example `PLN`. | | `period` | For subscriptions: `month` or `year`. | A paid theme installs into any store as a **trial**: the merchant can preview it but not publish or edit it until they buy a licence for that store. See [Publishing](publishing.md#trials-and-licences). ## Menus A theme declares **menu placements** - the places in its layout where a menu goes - with default contents. Installing the theme creates the menus a store does not have yet and assigns them; the merchant can then point any placement at any menu. ```json "menus": { "header": { "label": "t:menus.header.label", "handle": "main-menu", "title": "t:menus.header.title", "links": [ { "title": "t:menus.links.home", "type": "home" }, { "title": "t:menus.links.shop", "type": "category", "target": "all", "panel": { "mode": "links", "source": "categories", "depth": 2, "hide_empty": true } }, { "title": "t:menus.links.blog", "type": "blog" }, { "title": "t:menus.links.contact", "type": "url", "target": "/contact/" } ] }, "footer": { "label": "t:menus.footer.label", "handle": "footer", "links": [{ "type": "pages", "limit": 6 }] } } ``` A section reads a placement with a `link_list` setting whose value is the placement's `handle`. Link types, panels and the lazy menu levels are described in [Menus and widgets](menus-and-widgets.md). ## Widgets A widget is a **named, configured instance of one of your sections** that the merchant fills once and shows in many places - customer testimonials, a video wall, a store promise. Declare the placements and their default contents; installation creates the missing widgets and never overwrites a merchant's. ```json "widgets": { "testimonials": { "label": "t:widgets.testimonials.label", "handle": "testimonials", "name": "t:widgets.testimonials.name", "type": "testimonials", "settings": { "heading": "t:widgets.testimonials.heading" }, "blocks": { "one": { "type": "testimonial", "settings": { "quote": "…", "author": "…" } } }, "block_order": ["one"] } } ``` `settings` and `blocks` have exactly the shape of a section entry in a JSON template. See [Menus and widgets](menus-and-widgets.md#widgets). ## Translated values Any text value that starts with `t:` is a translation key from `locales/`, resolved in the store language at installation - `"t:menus.links.home"`. See [Translations](translations.md). --- # Templates Source: https://shopdepot.dev/docs/themes/templates/ A template decides which sections a page type shows. Templates are JSON only, in `templates/`, one per [page type](../reference/page-types.md). ## Format ```json { "sections": { "main": { "type": "main-product", "settings": { "gallery_layout": "auto", "show_breadcrumbs": true }, "blocks": { "title": { "type": "product-title" }, "price": { "type": "price", "settings": { "show_lowest_30d": true } }, "buy": { "type": "buy-buttons" } }, "block_order": ["title", "price", "buy"] }, "reviews": { "type": "product-reviews", "settings": { "limit": 10 } } }, "order": ["main", "reviews"] } ``` - `sections` - entries keyed by an id you choose, unique in the file. `type` is the file name of a section. - `settings` - values for the section's schema settings. Missing ones take the schema default. - `blocks` and `block_order` - the blocks inside a section, the same shape again, nested as deep as the blocks allow. - `order` - the order of sections on the page. - `"disabled": true` on an entry keeps it in the file but does not render it. The merchant's arrangement from the theme editor is stored with their store and wins over the file. Your file is what a new installation starts with - and what the editor offers to reset to. ## Page types Each storefront page type has a template and receives its own variables: `product.json` gets a `product`, `category.json` a `category` with its listing, `cart.json` the visitor's `cart`. The full list, with addresses and variables, is in [Page types](../reference/page-types.md). A store page without a template in your theme falls back to the platform's built-in rendering, so ship every type `base` ships. ### The category page Besides the name and the listing, a store category carries what the merchant set in **Catalog → Categories**: the page heading, a description, an image, an icon and a second description. All of them are optional, so test each one for emptiness: ```twig {% set c = category %} <h1>{{ c.heading }}</h1> {% if c.description %}<div class="rte">{{ c.description|raw }}</div>{% endif %} {% if c.image and pagination.page|default(1) == 1 %} {{ c.image|image_url(width: 2400)|image_tag(alt: c.image.alt, loading: 'eager', fetchpriority: 'high', sizes: '100vw') }} {% endif %} {# the listing #} {% if c.additionalDescription and pagination.page|default(1) == 1 %} <div class="rte">{{ c.additionalDescription|raw }}</div> {% endif %} ``` - `heading` is the H1 of the category page (the name when the merchant left it empty). Use `title` in menus, tiles and breadcrumbs. - `image` is a banner or a tile picture. On the category page it is usually above the fold, so it loads eagerly with `fetchpriority: 'high'`. - `additionalDescription` is longer text for below the products: a buying guide, an FAQ, SEO text. Show it on the first page of the listing only, so the same text is not repeated on `?page=2`. - `icon` is a small picture for menus and chips. It can be an SVG (`icon.vector`), which you can draw as a CSS mask so it takes the text colour. It is decorative, so give it an empty `alt`. Both descriptions are HTML cleaned by the platform, so print them with `|raw`. The same image and icon come in [`children.json`](menus-and-widgets.md#menu-levels-on-demand) for menus loaded on demand. Every field is in the [`category`](../reference/objects/category.md) reference. ## Alternate templates Some pages can use a different template than the default one of their type. The alternate goes after a dot: | File | Used for | | --- | --- | | `product.<suffix>.json` | Offers whose template the merchant set to `<suffix>` on the offer page. Every `product.*.json` in the published theme appears in that list. | | `category.<suffix>.json` | Store categories whose template the merchant set to `<suffix>` in **Catalog → Categories**. The choice belongs to one category: its subcategories stay on `category.json` until they pick their own. | | `page.<last path segment>.json` | The page at that address - `page.contact-us.json` renders `/contact-us/` and `/help/contact-us/`. | | `terms.<feature code>.json`, `term.<feature code>.json` | The index and value pages of one feature - `terms.authors.json`. | A suffix that does not exist in the theme renders the default template, so removing an alternate never breaks a page. ## Section groups `sections/header-group.json` and `sections/footer-group.json` hold the sections around every page, in the same format with a `type`: ```json { "type": "header", "sections": { "announcement": { "type": "announcement-bar", "settings": { "text": "Free delivery over 199 PLN" } }, "header": { "type": "header", "settings": { "menu": "main-menu" } } }, "order": ["announcement", "header"] } ``` The layout renders a group with `{{ sections('header-group') }}`. Section groups sit directly in `sections/`, not in a subfolder, and their names end with `-group.json`. ## Limits Keep a template to a reasonable number of sections - each one is rendered and cached separately, and every extra band is weight on the page. The theme store review looks at the default templates of your theme. --- # Sections and blocks Source: https://shopdepot.dev/docs/themes/sections-and-blocks/ Sections and blocks are what the merchant works with in the theme editor. A section is a band of a page; a block is a piece inside a section or inside another block. ## A section ```twig {# sections/content/image-with-text.twig #} {% set s = section.settings %} <section class="iwt iwt--{{ s.layout }}" {{ section.attributes }}> <div class="iwt__media"> {% if s.image %} {{ s.image|image_url(width: 1600)|image_tag(alt: s.image.alt, sizes: '(min-width: 900px) 50vw, 100vw') }} {% else %} {{ placeholder_svg('image', 'iwt__placeholder') }} {% endif %} </div> <div class="iwt__text">{{ content_for('blocks') }}</div> </section> {% stylesheet %} .iwt { display: grid; grid-template-columns: 1fr 1fr; gap: var(--gap, 24px); } .iwt--image-right .iwt__media { order: 2; } {% endstylesheet %} {% schema %} { "name": "t:sections.image_with_text.name", "settings": [ { "type": "image_picker", "id": "image", "label": "t:sections.image_with_text.image" }, { "type": "select", "id": "layout", "default": "image-left", "label": "t:sections.image_with_text.layout", "options": [ { "value": "image-left", "label": "t:sections.image_with_text.left" }, { "value": "image-right", "label": "t:sections.image_with_text.right" } ] } ], "blocks": [{ "type": "@theme" }], "presets": [ { "name": "t:sections.image_with_text.name", "blocks": { "heading": { "type": "text", "settings": { "text": "Made to last", "size": "xl" } }, "cta": { "type": "button", "settings": { "label": "Shop now", "url": "/categories/all/" } } }, "block_order": ["heading", "cta"] } ] } {% endschema %} ``` Three things every section does: - **`{{ section.attributes }}` on the root element.** The theme editor uses these attributes to select the section in the preview. - **Settings through `section.settings`**, already resolved: an `image_picker` gives a [file](../reference/objects/file.md), a `product` setting a [product](../reference/objects/product.md). An empty setting is `null`. - **Blocks with `{{ content_for('blocks') }}`**, where they belong in your markup. ## The schema | Key | Description | | --- | --- | | `name` | Name in the editor, usually a `t:` key. | | `settings` | The settings - see [Settings](settings.md) and [Setting types](../reference/setting-types.md). | | `blocks` | Which blocks the section accepts. A non-empty list is what tells the editor the section takes blocks at all - see below. | | `presets` | Ready configurations the merchant picks from "Add section". A section without a preset can only be placed in templates by you. | | `targets` | Where the block content editor offers the section or block: `page`, `post`, `offer`, `email`. Without it, it is a theme-only section. | | `group` | A category in the "Add section" list, for example `content`. | ## Blocks Theme blocks live in `blocks/` and must declare a schema. They render the same way as sections, with `block` instead of `section`: ```twig {# blocks/text.twig #} {% set size = block.settings.size|default('lg') %} <p class="block-text block-text--{{ size }}" {{ block.attributes }}>{{ block.settings.text }}</p> {% schema %} { "name": "t:blocks.text.name", "settings": [ { "type": "inline_richtext", "id": "text", "label": "t:blocks.text.text", "default": "Text" }, { "type": "select", "id": "size", "default": "lg", "label": "t:blocks.text.size", "options": [{ "value": "xl", "label": "XL" }, { "value": "lg", "label": "L" }, { "value": "md", "label": "M" }] } ] } {% endschema %} ``` ### Which blocks a section accepts | Entry in `blocks` | Means | | --- | --- | | `{ "type": "@theme" }` | Any theme block in `blocks/` (and the core blocks). | | `{ "type": "@app" }` | Blocks from apps, when apps arrive. Declaring it now costs nothing. | | `{ "type": "faq-item" }` | A block meant for this section. List several to describe a set. | ### Nesting A block can accept blocks too - declare `blocks` in its schema and print `{{ content_for('blocks') }}`. That is how layout blocks work: base ships `_group`, a flex container with direction, gap and alignment settings, and the merchant composes columns and rows from it without you writing each combination. Blocks nest up to four levels. A block that is listed by name in a parent's `blocks` is a **child block** - it is meant to live inside that parent only (`faq-item` inside `faq`). Child blocks do not declare `targets`. ### Private and system blocks A file name starting with an underscore - `_group.twig` - marks a system block: available for nesting, but not offered as a standalone item in the editor's list. ## Styles and scripts `{% stylesheet %}` in a section or block is collected, with every other one in the theme, into a single `_sections.css` that the platform links in `content_for_header`. The CSS loads once, however many times the section appears, and is cached with the theme version. `{% javascript %}` is collected into `_sections.js` the same way, but that file is not linked for you. Prefer a module in `assets/` loaded from the layout; see [Assets](assets.md). Style sections with the [brand tokens](platform-pages.md#brand-tokens) (`var(--color-accent)`, `var(--radius)`) and your own custom properties, not hard-coded colours - the merchant changes the tokens in theme settings and expects every section to follow. ## Documenting snippets and blocks `{% doc %}` holds the parameters a snippet expects. It never renders, but it is how the next developer - and the linter that is coming - knows how to call it: ```twig {% doc %} @param product - the product to show @param show_rating - optional, show stars under the title {% enddoc %} ``` ## The core library The platform ships sections and blocks to every theme, under your files: - Sections - `content`, `banner`, `media-text`, `callout`, `hero-tiles`, `product-list`, `term-grid`, `logo-wall`, `newsletter`, `testimonials`, `post-list`, `faq`, `contact-form`. - Blocks - `heading`, `paragraph`, `image`, `button`, `list`, `quote`, `columns`, `divider`, `spacer`, `html` and the child blocks of the sections above. They style themselves only with brand tokens, with fallbacks, so they look right in any theme. **Your file with the same name replaces the core one**: ship `sections/faq.twig` and the store uses yours, and the core CSS of `faq` is no longer loaded. Keep the setting ids of the core file when you do, so the merchant's content carries over. Settings and blocks of every core file are listed in [Core sections and blocks](../reference/core-sections.md). When a merchant switches themes, a section type the new theme does not know becomes a placeholder that keeps its settings, and comes back when the type is available again. Content is never lost. ## Data inside a section A section gets the variables of the page it is on (`product` on an offer page, `category` on a category page) plus the globals. When a section needs data the page does not give it - bestsellers on the home page, posts on a product page - it asks for it with the data functions: `query_products()`, `query_posts()`, `query_terms()`, `query_categories()`. They always read the current store. See [Functions](../reference/functions.md#data). --- # Settings Source: https://shopdepot.dev/docs/themes/settings/ Settings are the fields the merchant fills in the theme editor. You declare them in a schema; the platform builds the form, validates input and hands resolved values to your templates. ## Theme settings Theme-wide settings - colours, fonts, logo, page width - live in `config/settings_schema.json`, a list of groups: ```json [ { "name": "theme_info", "theme_name": "Example", "theme_version": "1.4.0", "theme_author": "Example Studio", "theme_documentation_url": "https://example.com/docs" }, { "name": "t:settings.colors.name", "settings": [ { "type": "color", "id": "color_background", "default": "#fafafa", "label": "t:settings.colors.background" }, { "type": "color", "id": "color_accent", "default": "#0f0f0f", "label": "t:settings.colors.accent" } ] }, { "name": "t:settings.layout.name", "settings": [ { "type": "range", "id": "page_width", "min": 1000, "max": 1800, "step": 20, "unit": "px", "default": 1440, "label": "t:settings.layout.page_width" }, { "type": "range", "id": "radius", "min": 0, "max": 24, "step": 1, "unit": "px", "default": 0, "label": "t:settings.layout.radius" } ] } ] ``` Templates read them from the global `settings`: `{{ settings.page_width }}`. A long schema can be split into `config/settings/*.json` - see [File structure](file-structure.md#settings-split-across-files). ## Section and block settings Sections and blocks declare settings in the `settings` array of their `{% schema %}`, with the same types. Read them as `section.settings.<id>` and `block.settings.<id>`. ## A setting | Key | Required | Description | | --- | --- | --- | | `type` | yes | One of the [setting types](../reference/setting-types.md). | | `id` | yes | Unique within its schema - `snake_case`. It is the key in templates and in stored values: **never rename it** in a released theme, or every store loses that value. | | `label` | yes | Field label, usually a `t:` key. | | `default` | | The starting value. Without it a setting is empty - `null`, or `false` for a checkbox. | | `info` | | Help text under the field. | | `placeholder` | | Placeholder for text fields. | | `options` | for `select` | A list of `{ value, label }`. | | `min`, `max`, `step`, `unit` | for `range` | The slider bounds; values outside them are clamped. | | `content` | for `header`, `paragraph` | The text shown in the editor. | | `limit` | for `store_reviews` | How many reviews. | ## Resolved values The platform does the lookup work before your template runs. A `product` setting gives a [product](../reference/objects/product.md) object, a `category_list` a list of categories, a `link_list` a [menu](../reference/objects/menu.md), an `image_picker` a [file](../reference/objects/file.md) you pass straight to `|image_url`. An offer that was deleted later simply drops out. Write templates for the empty case: ```twig {% if section.settings.product %} {{ render('product-card', { product: section.settings.product }) }} {% endif %} ``` `richtext` and `html` values are sanitised when the merchant saves them **and** when they are read, so `{{ section.settings.text|raw }}` is safe even for values that came from your package. ## Validation Input is checked against the schema when the merchant saves: numbers are clamped to the range, a `select` value must be one of the options, a colour must be `#rrggbb`, a URL must be a store path or an `http(s)`, `mailto:` or `tel:` address. Settings that are not in the schema are dropped. You never need to defend a template against a value the schema does not allow. ## Starting values `config/settings_data.json` holds the values a store starts with: ```json { "current": { "color_background": "#fafafa", "page_width": 1440 } } ``` ## Updates When a store updates to a new version of your theme: - every value the merchant set is kept, - new settings arrive with their defaults, - settings you removed are parked, not deleted, so rolling back brings them back. That is why `id`s are forever. To change what a setting means, add a new one. --- # Translations Source: https://shopdepot.dev/docs/themes/translations/ A theme speaks the language of the store it is installed in. Texts live in `locales/`, never in templates. ## Locale files ```text locales/ ├── en.default.json the fallback - every key must exist here └── pl.json one file per language, same keys ``` ```json { "cart": { "title": "Cart", "empty": "Your cart is empty", "items": "{{ count }} items" } } ``` The store language decides the file; a key missing in it falls back to `*.default.json`. ## In templates ```twig <h1>{{ 'cart.title'|t }}</h1> <p>{{ 'cart.items'|t({ count: cart.itemCount }) }}</p> ``` Parameters replace `{{ name }}` (or `%name%`) in the text. ## In JSON Any text value in a schema, a template, `theme.json` or `settings_data.json` can be a key with the `t:` prefix - `"label": "t:sections.hero.name"`. Editor labels and default contents of menus and widgets are translated this way when the theme is installed, so a store gets its menus in its own language. ## What not to translate Content the merchant writes - product names, page text, setting values - is theirs and is not part of `locales/`. Translate only what your theme itself puts on the page: buttons, labels, empty states, accessibility texts like "Skip to content". --- # The Twig sandbox Source: https://shopdepot.dev/docs/themes/twig-sandbox/ Theme templates run in a Twig sandbox. A theme is code from outside the platform rendered for every visitor of a store, so the sandbox decides exactly what it can reach: the data of **this** store, through read-only objects, and nothing else. ## What is allowed - The [tags](../reference/tags.md): `if`, `for`, `set`, `apply`, `with`, `verbatim`, `do`, plus the theme tags `schema`, `stylesheet`, `javascript` and `doc`. - The [filters](../reference/filters.md): common Twig filters and the ShopDepot ones - `money`, `image_url`, `asset_url`, `t` and others. - The [functions](../reference/functions.md): rendering (`content_for`, `render`, `sections`, `render_widget`), platform components, data queries and `url_for`. - Reading [objects](../reference/objects/index.md) and calling their methods. Everything else is refused. A template that uses something outside these lists **does not save** when you write it with the code editor, the [CLI](cli.md) or the [theme API](theme-api.md) - the error comes back with the file name and line, not on a live page. A ZIP upload is checked for syntax and the file contract; run `shopdepot theme check` before you upload one, so sandbox errors do not wait until a page renders. ## What is not allowed, and what to use instead | Not available | Use instead | | --- | --- | | `{% extends %}`, `{% block %}` | One layout (`layout/theme.twig`) around JSON templates. | | `{% include %}` tag, `{% macro %}`, `{% import %}`, `{% embed %}` | Snippets: `{{ render('snippet-name', { … }) }}`. | | Reading object properties directly | Getters through the dot: `product.title`. | | PHP functions, files, the network, `{% sandbox %}`, `{% use %}` | The [data functions](../reference/functions.md#data) for store data, the [JSON APIs](javascript-apis.md) in the browser. | | Filters and functions not in the reference | Ask for them - if a theme needs something often, it belongs in the platform. | ## Objects only The sandbox allows method calls on platform objects and on nothing else. Arrays and hashes - `section.settings`, `cart.discounts` entries, `pagination` - are read with the dot as usual. Entities, services and repositories never reach a template, so a theme cannot read another store's data or call anything that writes. ## Names are camelCase Object fields are getters, and Twig maps `product.featuredMedia` to `getFeaturedMedia()`. Write the camelCase name from the reference. `product.featured_media` does not exist and prints nothing. ## Escaping Output is escaped as HTML automatically. Use `|raw` only for HTML the platform already sanitised - offer descriptions, page and post content, `richtext` and `html` settings, `panelHtml` of a menu link. Never put `|raw` on text from a setting of another type, a URL or a translation that takes parameters. To pass data to a script, build a hash of the values you need - objects themselves do not serialise - and escape it for the attribute: ```twig <div data-product="{{ { id: product.id, price: product.price, available: product.available }|json_encode|e('html_attr') }}"></div> ``` ## Undefined values Variables that do not exist are empty, not errors - `{{ product.subtitle }}` on a field that does not exist prints nothing. That keeps a page alive when data is missing, and it also hides typos. Check names against the reference. ## Snippets have their own scope `render()` gives a snippet only what you pass, plus `shop`, `settings` and `cart`. Variables of the calling section do not leak in, so a snippet behaves the same wherever it is used: ```twig {# in a section #} {% for item in products %} {{ render('product-card', { product: item, show_rating: section.settings.show_rating }) }} {% endfor %} ``` A missing snippet renders nothing instead of breaking the page. ## When a section fails An error while rendering one section - a division by zero, a broken loop - is logged and that section renders empty. The rest of the page is served. Watch for empty bands in preview; the code editor shows syntax errors before they get that far. --- # Assets and fonts Source: https://shopdepot.dev/docs/themes/assets/ Everything the browser loads from your theme lives in `assets/`, in folders if you like: `assets/css/theme.css`, `assets/js/theme.js`, `assets/fonts/`, `assets/img/`. ## Referencing an asset `asset_url` takes the path **inside** `assets/`: ```twig {{ 'css/theme.css'|asset_url|stylesheet_tag }} {{ 'js/theme.js'|asset_url|script_tag }} <img src="{{ 'img/badge.svg'|asset_url }}" alt="" width="48" height="48"> ``` The address contains a fingerprint of the theme version and is served from the store CDN with a cache lifetime of a year. A new version of your theme gets a new fingerprint, so browsers fetch the changed files at once and nothing ever needs a cache-busting query string. In CSS, use relative paths between files in `assets/` - `url("../fonts/example.woff2")` from `assets/css/theme.css`. ## JavaScript Ship plain ES modules. `script_tag` produces `<script type="module" defer>`. There is no bundler in the platform: if you use one locally, commit its output to `assets/`. Keep scripts small and progressive. Every storefront page must work without JavaScript for the basics - links, the add-to-cart form, search - and use scripts to make them nicer. The platform's own forms (contact, newsletter) already work both ways. ## Fonts Self-host fonts in `assets/fonts/` as `woff2` and declare them with `@font-face` in your [brand tokens snippet](platform-pages.md#brand-tokens), so the platform's pages in the store use them too. Preload the one file the first screen needs: ```twig <link rel="preload" href="{{ 'fonts/example-latin.woff2'|asset_url }}" as="font" type="font/woff2" crossorigin> ``` Use `font-display: swap` and split large fonts by `unicode-range` (latin, latin-ext) so a store in Polish does not download Cyrillic. Make sure the font licence allows web embedding and redistribution with a theme. ## Images that belong to the theme Decorations - a pattern, an icon, an illustration - go in `assets/img/`. Images that are content - a hero photo, a banner - are **settings** (`image_picker`), uploaded by the merchant to their media library. A theme that ships content images in `assets/` forces the merchant to edit code to change them. Every PNG and JPG in `assets/` gets a WebP copy when the theme is saved, if the copy is at least 10% smaller. `asset_url` then gives the address of the WebP file. Keep writing `.png` and `.jpg` in templates and settings; you do not ship WebP files yourself. GIF files and `demo/assets/` stay as they are. The platform logo fallback for its own pages in the store is `assets/img/logo.svg` - see [Platform pages](platform-pages.md#logo). ## Limits - 2 MB per binary file, 256 KB per text file. - Binary types: `png`, `jpg`, `jpeg`, `gif`, `webp`, `avif`, `ico`, `woff`, `woff2`, `ttf`, `otf`, `eot`. SVG is text. - Lowercase paths, at most four levels from the theme root (`assets/img/icons/cart.svg`). --- # Menus and widgets Source: https://shopdepot.dev/docs/themes/menus-and-widgets/ Menus and widgets are content the merchant manages outside the theme editor, in the store's admin. Your theme declares where they go and what they start with. ## Menu placements Declare placements in [`theme.json`](theme-json.md#menus). Installing or publishing the theme creates a store menu for each placement that has none and assigns it; a merchant's own assignment always wins. A section reads a menu with a `link_list` setting: ```json { "type": "link_list", "id": "menu", "default": "main-menu", "label": "t:sections.header.menu" } ``` The value is a menu handle or a placement handle, and the template gets a [menu](../reference/objects/menu.md) object: ```twig {% set menu = section.settings.menu %} {% if menu %} <nav aria-label="{{ menu.title }}"> <ul> {% for link in menu.links %} <li> <a href="{{ link.url }}"{% if link.active %} aria-current="page"{% endif %}>{{ link.title }}</a> {% if link.links %} <ul>{% for child in link.links %}<li><a href="{{ child.url }}">{{ child.title }}</a></li>{% endfor %}</ul> {% endif %} </li> {% endfor %} </ul> </nav> {% endif %} ``` ## Link types | `type` | Points at | `target` | | --- | --- | --- | | `home` | The home page | - | | `page` | A store page | page | | `post` | A blog post | post | | `blog` | The blog | - | | `product` | An offer | offer | | `category` | A store category, or `all` for every top-level category | category or `all` | | `url` | Any address: a store path, `http(s)`, `mailto:`, `tel:`, `#` | the address | | `pages` | (default contents only) the store's top-level pages, up to `limit` | - | Links to drafts and deleted items are hidden automatically. ## Mega-menu panels A top-level link can open a panel. The merchant configures it per link; your template reads it from the [link](../reference/objects/link.md): - `link.hasPanel`, `link.panel` - the mode: `links`, `html_links` or `html`, - `link.links` and `link.levels` - the columns (subcategories are filled in automatically for a category link with `source: categories`), - `link.panelHtml` - the merchant's own HTML, sanitised, - `link.featured` - an offer pinned to the panel. ## Menu levels on demand A store can have hundreds of categories. Do not render them all into every page: render the levels the panel shows and load deeper ones when the visitor gets there. A category link has `link.hasChildren` and `link.childrenUrl`: ```http GET /categories/<handle>/children.json?sort=popular&limit=12&products=3 ``` ```json { "category": { "id": "…", "handle": "face", "title": "Face", "url": "/categories/face/" }, "total": 74, "children": [ { "id": "…", "handle": "serums", "title": "Serums", "url": "/categories/serums/", "count": 18, "has_children": true, "children_url": "/categories/serums/children.json", "icon": "https://cdn.example/m/…/icon.svg", "icon_vector": true, "image": "https://cdn.example/m/…/serums_480.webp" } ], "products": [ { "id": "…", "title": "…", "url": "…", "image": "…", "price": 12900, "price_formatted": "129,00 zł", "price_varies": false, "available": true } ] } ``` `icon` is the category icon set in the admin (null without one) and `icon_vector` says it is an SVG - in the page the same icon is `category.icon` (see [`category`](../reference/objects/category.md)). `image` is the category image as a 480 px thumbnail (null without one), for category tiles in a mega menu - in the page it is `category.image`. `all` instead of a handle returns the top-level categories. Parameters: `sort=popular` (units sold in 90 days), `limit` (0 for all - `total` always counts all), `products` (bestsellers of the category, up to 6), `empty=1` (include categories without offers). The answer is the same for every visitor and cached for five minutes in the browser. ## Widgets A widget is a configured, named instance of one of your sections that the merchant fills once and shows in many places - for example the same testimonials on the home page and on every offer page. Change it once, it changes everywhere. Declare widget placements in [`theme.json`](theme-json.md#widgets). A section points at a widget with a `widget` setting and renders it: ```json { "type": "widget", "id": "testimonials", "default": "testimonials", "label": "t:sections.slot.widget" } ``` ```twig {{ render_widget(section.settings.testimonials) }} ``` `render_widget('testimonials')` also works with a handle or placement name. A placement the merchant has not filled renders nothing. `base` ships `widget-slot`, a section that only renders a chosen widget - reuse it. If the merchant switches to a theme without that section type, the widget renders nothing and keeps its content for when the type is back. --- # Platform pages and components Source: https://shopdepot.dev/docs/themes/platform-pages/ Some pages and components in a store belong to the platform: checkout, customer accounts, returns, the review form, the contact form and the cart summary. They behave the same in every store. Your theme makes them look like the store through two contracts - **brand tokens** for whole pages, and **stable class names** for components inside your pages. ## Brand tokens `snippets/brand-tokens.twig` is a contract with the platform. Your layout renders it in `<head>`, and so do the platform's own pages on the store domain - the account, order status, returns and complaints - so they take the store's colours, radius and fonts from your theme without a second set of settings. ```twig {# snippets/brand-tokens.twig #} {% set s = settings %} <style> @font-face { font-family: "Example Sans"; font-weight: 100 900; font-display: swap; src: url("{{ 'fonts/example-sans.woff2'|asset_url }}") format("woff2"); } :root { --color-bg: {{ s.color_background|default('#ffffff') }}; --color-surface: {{ s.color_surface|default('#f2f2f2') }}; --color-ink: {{ s.color_text|default('#111111') }}; --color-accent: {{ s.color_accent|default('#111111') }}; --color-accent-ink: {{ s.color_accent_ink|default('#ffffff') }}; --radius: {{ s.radius|default(8) }}px; --base-size: {{ s.base_size|default(16) }}px; --heading-weight: {{ s.heading_weight|default('600') }}; --font-body: "Example Sans", system-ui, sans-serif; } </style> ``` | Token | Required | Meaning | | --- | --- | --- | | `--color-bg` | yes | Page background. | | `--color-surface` | yes | Cards, fields, boxes on the background. | | `--color-ink` | yes | Text. | | `--color-accent` | yes | Buttons and links. | | `--color-accent-ink` | yes | Text on the accent. | | `--radius` | yes | Corner radius of buttons, fields and cards. | | `--base-size` | yes | Base font size. | | `--heading-weight` | yes | Weight of headings. | | `--font-body` | yes | Body font stack. | | `--font-display` | | Headings font stack. | | `--font-mono` | | Monospace font stack. | | `--radius-pill` | | Radius of pill buttons. | | `--button-transform` | | `uppercase` or `none` for button labels. | Rules of the contract: - The file name is fixed: `snippets/brand-tokens.twig`. - Output only custom properties on `:root`, plus what the fonts need (`@font-face`, a `<link>` to a font file). **No rules for elements** - the platform pages have their own layout and components, and a `button { … }` in this snippet would break them. - The platform never reads your settings by name - every theme names them differently. It reads the tokens. The core sections and blocks style themselves with the same tokens, which is why they fit any theme. Use them in your own CSS too. ## Logo Platform pages show the store logo from your theme: the `logo` setting (and `logo_width`) when the merchant uploaded one, otherwise `assets/img/logo.svg` from your package. Ship a sensible `logo.svg`. ## The contact form The contact form is a platform component. Your contact page or section places it, and the platform draws the fields, consents, validation, spam protection and sending: ```twig {{ form('contact') }} ``` Which fields are shown and required, the subject list and the consents are set by the merchant in the store settings. You style the form with these classes - they are a contract and do not change: | Class | Element | | --- | --- | | `sd-form` | The form. | | `sd-form__field`, `sd-form__field--<name>` | A field wrapper, with a modifier per field. | | `sd-form__label`, `sd-form__req` | Label and the required marker. | | `sd-form__input`, `sd-form__textarea`, `sd-form__select`, `sd-form__file` | Controls. | | `sd-form__error` | A field error. | | `sd-form__consents`, `sd-form__consent`, `sd-form__check`, `sd-form__box`, `sd-form__consent-text` | Consents. | | `sd-form__submit` | The button. | | `sd-form__message[data-state]` | The result message - `data-state` is `ok` or `error`. | | `sd-form__reference` | The message reference number after sending. | The default styles use `:where()`, so any rule of yours wins without `!important`. ### Options ```twig {{ form('contact', { submit: 'Send', classes: { field: 'field', input: 'input', button: 'btn btn--primary' }, subject: 'Wholesale enquiry', phone: 'required', order: 'off', fields: [ { name: 'company', label: 'Company', type: 'text', required: true }, { name: 'volume', label: 'Monthly volume', type: 'select', options: ['Under 100', '100-1000', 'Over 1000'] } ] }) }} ``` | Option | Description | | --- | --- | | `submit` | The button label. | | `classes` | Your own classes added to `field`, `label`, `input`, `textarea`, `select`, `file`, `error`, `consent`, `button`, `message`. | | `subject` | A fixed subject - for a partner or wholesale form on its own page. | | `phone`, `order`, `message` | `off`, `optional` or `required`. | | `fields` | Up to 12 extra fields: `name`, `label`, `type` (`text`, `email`, `tel`, `url`, `number`, `textarea`, `select`, `checkbox`), `required`, `placeholder`, `options`. Their answers are added to the message. | These options are signed into the form, so a visitor cannot change them. The name, e-mail and consent fields cannot be changed by a theme. The form sends with JavaScript in the background (`POST /contact/send.js`) and works without it as a normal form post. ## The cart summary On the cart page, print the platform's summary: ```twig <aside class="cart__summary">{{ cart_summary() }}</aside> ``` It holds the coupon field, applied discounts and threshold hints, delivery from the cheapest method, the estimated total, the "including VAT" line when the store shows it, and the checkout button. It applies coupons in place (`POST /cart/discount.js`) and then fires `shopdepot:cart:changed` with the new cart and the fresh cart page, so you can refresh your line items. Style it with its `sd-cart-summary__*` classes; its content and behaviour are not themeable. ## The chat widget When the merchant turns on the chat (**Customer service → Settings → Chat**), the platform adds the widget to every page your theme renders, just before `</body>`. The theme does nothing: no snippet, no script, no styles to ship. The widget has its own styles and does not depend on your CSS. Do not put an element with `id="sd-chat"` in your theme. A page that has one is left alone, because the platform takes it for a widget that is already there. ## Checkout and accounts Checkout, the thank you page, customer accounts, order status, returns and complaints are rendered by the platform outside your theme. There are no theme files for them and none are read. Checkout is branded by the merchant in the store settings; the account and returns pages use your [brand tokens](#brand-tokens) and [logo](#logo). Link to them with [`url_for`](../reference/functions.md#url_for): `url_for('account')`, `url_for('cart')`. Checkout is reached from the cart. --- # JavaScript APIs Source: https://shopdepot.dev/docs/themes/javascript-apis/ Pages are cached and the same for every visitor, so anything personal - the cart count, items in the wishlist - is read in the browser. The storefront offers small JSON endpoints for it, modelled on Shopify's AJAX API: field names and amounts in minor units match, so ported code needs little change. All endpoints are on the store's own domain. Requests that change something (`POST`) are accepted only from the store's own pages - browsers send `Sec-Fetch-Site` or `Origin` with `fetch()` on their own; there is no CSRF token to pass. Store addresses end with a slash; the `.js` and `.json` endpoints are files and do not. ## Cart ### Read the cart ```js const cart = await fetch('/cart.js', { headers: { Accept: 'application/json' } }).then((r) => r.json()); ``` ```json { "token": null, "item_count": 3, "items": [ { "key": "0192f…", "id": "0192e…", "title": "Linen shirt", "product_title": "Linen shirt", "variant_title": "L / Natural", "quantity": 1, "price": 18900, "compare_at_price": 22900, "properties": { "Engraving": "For Anna" }, "options_with_values": [{ "name": "Engraving", "value": "For Anna", "price": 1500 }], "line_price": 18900, "url": "/products/linen-shirt/", "image": "https://cdn…/m/…/large.webp", "available": true } ], "items_subtotal_price": 37800, "total_discount": 0, "total_price": 37800, "currency": "PLN", "requires_shipping": true, "checkout_url": "/checkout/", "shipping_from": 1299, "drawer_buttons": "cart" } ``` `shipping_from` is the cheapest delivery for this cart, computed exactly as checkout computes it - write "Delivery from …" from it, never from a theme setting. `null` means no method fits. `drawer_buttons` is the store's choice for a cart drawer: which buttons it shows. ### Add to the cart ```js const response = await fetch('/cart/add.js', { method: 'POST', headers: { 'Content-Type': 'application/json', Accept: 'application/json' }, body: JSON.stringify({ id: variantId, quantity: 1, properties: { [fieldId]: 'For Anna' } }), }); const result = await response.json(); // result: the added line, `cart`, `redirect` and `after_add` ``` | Field | Description | | --- | --- | | `id` | The [variant](../reference/objects/variant.md) id - `variant.id`, or `item.variantId` of a cart line. | | `quantity` | Units, at least 1. | | `properties` | Values of [product option fields](../reference/objects/product.md) by field id - use the `name` from `product.optionFields`. | | `checkout` | `true` to go straight to checkout - `redirect` then points there. | `after_add` tells you what the store wants after adding: open the cart drawer, go to the cart, stay. `redirect` is where to go when the answer is to leave the page. The same `POST /cart/add/` works as a plain form, so the add-to-cart button works without JavaScript: ```twig <form action="/cart/add/" method="post"> <input type="hidden" name="id" value="{{ product.selectedOrFirstAvailableVariant.id }}"> <button type="submit"{% if not product.available %} disabled{% endif %}>{{ 'product.add_to_cart'|t }}</button> </form> ``` ### Change and clear ```js await fetch('/cart/change.js', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ line: item.key, quantity: 2 }) }); // 0 removes the line await fetch('/cart/clear.js', { method: 'POST' }); ``` `line` is the line `key` from `/cart.js` (or `item.id` of a cart line object). Both answer with the whole cart. ### Discount codes ```js const json = { method: 'POST', headers: { 'Content-Type': 'application/json', Accept: 'application/json' } }; await fetch('/cart/discount.js', { ...json, body: JSON.stringify({ code: 'SPRING10' }) }); // adds a code await fetch('/cart/discount.js', { ...json, body: JSON.stringify({ remove: 'SPRING10' }) }); // removes one code await fetch('/cart/discount.js', { ...json, body: JSON.stringify({ code: '' }) }); // removes every code ``` A cart holds up to five codes. `code` adds a code to the ones already in the cart; it never replaces them. A code that does not combine with the codes in the cart answers 422 and is not kept. A valid code whose conditions the cart does not meet yet (a minimum value, for example) stays in the cart and applies once it does. `/cart.js` lists the codes in `discount_codes`: `[{ "code": "SPRING10", "applicable": true, "message": null }]`, where `message` says why a code does not apply yet. In Twig the same list is [`cart.discountCodes`](../reference/objects/cart.md). The [cart summary](platform-pages.md#the-cart-summary) already does this for you. `/discount/<CODE>/?redirect=/products/example/` is a link that puts a code in the cart and goes to a page of the store. ### Errors A failed request answers with a status of 4xx and `{ "status": 422, "message": "…", "description": "…" }` - show `message` to the visitor. ## Wishlist ```js const wishlist = await fetch('/wishlist.js').then((r) => r.json()); // { "count": 2, "items": ["<offer id>", "<offer id>"], "url": "/wishlist/", "logged_in": false } await fetch('/wishlist/add.js', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ id: product.id, variant: variantId }) }); await fetch('/wishlist/remove.js', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ id: product.id }) }); ``` Guests have a wishlist too; it moves to their account when they log in. The wishlist page itself is a platform page in the customer account. ## Back-in-stock alerts When a product is out of stock, show a "notify me when it is back" form instead of a disabled "Add to cart" button. The platform keeps the sign-ups and e-mails each visitor once when the product, or the variant they chose, can be bought again. The e-mail has a link to the product and an opt-out link. The theme only sends the form. The merchant sees the sign-ups in **Back in stock alerts** in the store panel and edits the e-mail as the **Product back in stock** notification. There is nothing to turn on in the theme settings and no Twig function for it: the theme draws the form itself. Show the form when `product.available` is false - no variant can be bought. When only some variants are sold out, either keep the normal picker with the sold-out variants greyed out, or show the form for the selected variant when `variant.available` is false. ```twig {% set variant = product.selectedOrFirstAvailableVariant %} {% if not product.available %} <form class="notify" method="post" action="/back-in-stock/subscribe/" data-notify> <input type="hidden" name="id" value="{{ product.id }}"> <input type="hidden" name="variant" value="{{ variant ? variant.id : '' }}"> <input type="text" name="website" tabindex="-1" autocomplete="off" hidden> <label>Your name <input type="text" name="name" required autocomplete="given-name"></label> <label>E-mail <input type="email" name="email" required autocomplete="email"></label> <button>Notify me</button> <p data-notify-message hidden></p> </form> {% endif %} ``` ```js document.querySelectorAll('[data-notify]').forEach((form) => { form.addEventListener('submit', async (event) => { event.preventDefault(); const res = await fetch('/back-in-stock/subscribe.js', { method: 'POST', body: new FormData(form), headers: { Accept: 'application/json' } }); const data = await res.json(); // 200: { "status": "ok", "message": "…", "email": "jan@example.com" } // 422: { "status": "error", "message": "…", "field": "email" } const message = form.querySelector('[data-notify-message]'); message.textContent = data.message; message.hidden = false; }); }); ``` | Field | Description | | --- | --- | | `id` | The product id (`product.id`). Required. | | `variant` | The variant id. Optional - empty means "any variant of this product". | | `email` | Required, a valid address. | | `name` | Required. | | `phone` | Optional. | | `website` | Keep it empty: it is a trap for bots. A filled one gets a success answer and is not saved. | - Send the fields as a form (`FormData` or `application/x-www-form-urlencoded`), not as JSON. - `POST /back-in-stock/subscribe.js` answers with JSON: 200 when the sign-up is saved, 422 with `message` and, for a wrong field, `field` (`email`, `name` or `phone`). Show `message` next to that field, or above the form when there is no `field`. Messages are in the store's language. - `POST /back-in-stock/subscribe/` takes the same fields without JavaScript and sends the visitor back to the product page. - The same e-mail for the same product and variant is one sign-up - sending again only updates the name and phone. One visitor IP can send about 10 sign-ups an hour. - After a successful sign-up, replace the form with a confirmation that shows `email`, and offer to sign up another address. - Password managers like to add their icon to a name + e-mail pair. If that bothers you, keep the inputs outside a `<form>`, give them neutral names and build the `FormData` in your script with the field names above. ## Search suggestions ```http GET /search/suggest.json?q=linen&limit=6 ``` ```json { "query": "linen", "products": [{ "id": "…", "title": "…", "url": "…", "image": "…", "price": 18900, "price_formatted": "189,00 zł", "price_varies": true, "available": true }], "categories": [], "pages": [], "articles": [] } ``` `limit` is 1 to 10. Debounce the input - one request per pause in typing, not per key. ## Menu levels `GET /categories/<handle>/children.json` returns the subcategories of a category for a mega-menu or a mobile drawer. See [Menu levels on demand](menus-and-widgets.md#menu-levels-on-demand). ## Newsletter ```html <form action="/newsletter/subscribe/" method="post"> <input type="email" name="email" required> <input type="text" name="website" tabindex="-1" autocomplete="off" hidden> <button>Subscribe</button> </form> ``` `POST /newsletter/subscribe.js` takes the same fields and answers with JSON. Keep the empty `website` field: it is a trap for bots and a filled one is rejected. The core `newsletter` section does all of this - prefer it. ## Platform events `shopdepot:cart:changed` is dispatched on `document` by the [cart summary](platform-pages.md#the-cart-summary) after a coupon is applied or removed. `detail` is `{ cart, document }` - the cart JSON and the freshly rendered cart page. By default the platform then replaces your cart section with the fresh one; call `preventDefault()` if your theme updated the page itself: ```js document.addEventListener('shopdepot:cart:changed', (event) => { renderLines(event.detail.document.querySelector('[data-cart-lines]')); event.preventDefault(); }); ``` `base` adds a few conventions of its own you can copy: it emits `shopdepot:cart:updated` after every cart change it makes and `shopdepot:variant:change` when the variant picker changes, and exposes `window.ShopDepot.cart` and `window.ShopDepot.menu` helpers. Those are theme code, not a platform API - keep them if your theme builds on base. ## Consent Scripts the merchant adds to the store run only with the visitor's consent, decided in the browser from the `sd_consent` cookie. When the page has such scripts, the platform adds a small loader with `window.ShopDepot.consent`: ```js window.ShopDepot?.consent?.set({ analytics: true, marketing: false }); // stores the choice and runs what it allows window.ShopDepot?.consent?.get(); // { necessary: true, analytics: …, marketing: … } ``` A cookie banner that writes its own `sd_consent` cookie (JSON like `{"marketing":true}` or a list like `necessary,analytics`) dispatches `shopdepot:consent` on `window` afterwards. Your theme does not need any of this unless it ships its own cookie banner. --- # Performance and caching Source: https://shopdepot.dev/docs/themes/performance/ A ShopDepot store serves most pages as finished HTML from a cache, and every section as a cached fragment. A fast theme works with that instead of against it. ## The page is the same for everyone The home page, offer pages, categories, content pages, feature pages and the blog are rendered once and served to every visitor until something they show changes. The platform clears exactly the affected pages when the merchant edits an offer, a category, a menu, the theme or its settings, and rebuilds them in the background. So your markup must not depend on the visitor: - **No cart data in sections.** Outside the cart page `cart` is empty on purpose. Read the count and the drawer contents from [`/cart.js`](javascript-apis.md#cart). - **No "logged in as".** Show account links, and personalise in the browser if you must. - **No wishlist state.** Mark hearts from [`/wishlist.js`](javascript-apis.md#wishlist). - **No CSRF tokens in forms.** Storefront forms are protected by origin checks instead. - **No `random()`, no "now".** A random pick or a countdown computed on the server is frozen for everyone until the next rebuild. Do it in JavaScript. The cart page, checkout, accounts and search are never cached. ## Data from functions is tracked Each section records what it read - this offer, that category, the catalogue, a menu - and its cached fragment is cleared when that data changes. Read data through objects and the [data functions](../reference/functions.md#data), and the cache stays correct without you doing anything. Data you hard-code into a section (an offer handle in a template) is not tracked. ## Images Every `<img>` and `<iframe>` without a `loading` attribute is made lazy by the platform (`loading="lazy"`, `decoding="async"`) before the page is sent. That is right for almost every image - and wrong for the first one on the screen, which becomes the Largest Contentful Paint. > [!IMPORTANT] > Give the image above the fold `fetchpriority="high"` or `loading="eager"`, or it will wait for the lazy loader: the hero image, the first gallery picture of an offer, the cover of a post. ```twig {{ product.featuredMedia|image_url(width: 1600)|image_tag(alt: product.title, loading: 'eager', sizes: '(min-width: 900px) 50vw, 100vw') }} ``` Ask for the width you show: `|image_url(width: 800)` for a card, 1600 for a hero. Give `width` and `height` (or an `aspect-ratio` in CSS) so the layout does not jump while images load. Images come from the store CDN on its own host; the platform adds a `preconnect` for it. ## HTML is minified Storefront HTML is minified before it is sent: comments go, whitespace collapses to one space, and no space is kept next to block elements. Do not rely on a line break in a template for a visible gap - use CSS `gap` or `margin`. Inline JavaScript is minified too; template literals and `type="text/template"` scripts are left alone. ## CSS and JavaScript - Section and block CSS in `{% stylesheet %}` ends up in one cached file. Keep the theme stylesheet lean and avoid importing large frameworks. - Load scripts as deferred modules. Nothing should block the first render. - Self-host fonts, preload one file, and use `font-display: swap`. See [Assets](assets.md#fonts). - Do not load third-party scripts from the theme. Merchants add tracking and widgets themselves, with consent. ## Large catalogues Stores can have tens of thousands of offers and hundreds of categories. Never render a full category tree into every page: use [menu levels on demand](menus-and-widgets.md#menu-levels-on-demand). Lists are paginated by the platform; respect `pagination` instead of asking for more. ## Addresses Every store address ends with a slash - `/cart/`, `/products/example/`, `/blog/`. Write links that way, or the visitor gets an extra redirect. Files (`/cart.js`, `asset_url` addresses) do not. --- # SEO Source: https://shopdepot.dev/docs/themes/seo/ Search metadata is the platform's job, set by the merchant once for the whole store. A theme renders good markup and leaves the head to `content_for_header`. ## What the platform writes `{{ content_for_header }}` contains, for every page: - `<meta name="description">` - the SEO description of the object, or the store's template for that page type, or a short excerpt, - `<link rel="canonical">` on the store's main domain, without sorting, filters or `?variant=` (lists keep `?page=`), - `robots` - `noindex` for search results, the cart and anything the merchant hid, - Open Graph tags - type, title, description, image, locale - and product price and availability on offer pages, - the `<title>`: the platform **replaces the first `<title>` of your layout** with the title from the store's SEO templates. Do not add your own description, canonical, robots or Open Graph tags - the page would have two. ## What the theme does - **One `<h1>` per page** - the offer title, the category name, the page title. Block-level headings in sections are `<h2>` and below; the core `heading` block keeps `h1` for the page title. - **Real links.** Products, categories and pagination are `<a href>`, not click handlers, so crawlers follow them. - **Alternative text.** `alt` from `media.alt` for product pictures, empty `alt=""` for decorations. - **Breadcrumbs** from `category.ancestors` - they help visitors and search engines. - **Structured data where it describes what is on the page.** If you print Product or Review JSON-LD, its values must match what the visitor sees - the rating in `aggregateRating` must come from the reviews shown on that page. The core `faq` section has an option for FAQ structured data. - **Lazy images below the fold, an eager one above it.** See [Performance](performance.md#images). ## Sitemaps and robots.txt `/sitemap.xml` and `/robots.txt` of every store are generated by the platform from the published content and the merchant's SEO settings. A theme has no files for them. --- # Accessibility Source: https://shopdepot.dev/docs/themes/accessibility/ An accessible store sells to more people, and the European Accessibility Act makes it a requirement for many online shops. The theme store reviews every theme against this baseline, close to WCAG 2.1 AA. ## Structure - `<html lang="{{ shop.locale }}">`, one `<h1>`, headings in order. - Landmarks: `<header>`, `<nav aria-label="…">`, `<main id="main">`, `<footer>`. - A "Skip to content" link as the first focusable element. ## Keyboard - Everything that works with a mouse works with the keyboard: menus, drawers, the gallery, the variant picker, quantity fields. - Visible focus. Never `outline: none` without a replacement. - Drawers and dialogs move focus in, keep it inside and return it when closed. `Esc` closes them. Prefer `<dialog>`. - Mega-menus open on click or Enter, not only on hover. ## Colour and text - Text contrast at least 4.5:1, large text and controls 3:1 - with the default settings **and** the colour presets you ship. - Prices on sale say so in text, not only in red: visually hidden "Sale price" and "Regular price" labels. - Text can be zoomed to 200% without content being cut off. ## Images and media - `alt` on informative images, `alt=""` on decorations. - Video does not autoplay with sound; anything that moves for more than five seconds can be paused. - Respect `prefers-reduced-motion` for parallax, scroll effects and carousels. ## Forms - Every field has a `<label>`. Placeholders are not labels. - Errors are announced (`aria-live` or focus moves to them) and say how to fix the problem. - Platform forms - contact, newsletter, checkout - already do this; keep it when you style them. ## Dynamic updates - Announce cart updates - "Added to cart", the new count - in an `aria-live="polite"` region. - A variant change that changes the price or availability updates text a screen reader can reach. --- # Publishing and the theme store Source: https://shopdepot.dev/docs/themes/publishing/ The [theme store](https://themes.shopdepot.pl/) is the public catalogue merchants install themes from. Each theme has a listing page, a live demo store and an "Add to store" button. ## How a theme gets listed 1. Build and test the theme in a development store. 2. Go through the [review checklist](checklist.md). 3. Send the package (a ZIP of the theme folder) to the ShopDepot team. We publish it to the theme registry - first as **private**, visible only to you, then **public** after review. Self-service submission for partners is on the roadmap. Until then, everything below is what we look at in your package. ## The listing comes from the package The theme store page is built from [`theme.json`](theme-json.md): `name`, `summary`, `description`, `categories`, the `catalog` block (tagline, highlights, documentation and support links) and `pricing`. The listing always shows what the **published version** says - to change the text or the price, publish a new version. Screenshots are the only part uploaded separately; until there are some, the catalogue tile is drawn from the `preview` colours. Write the listing for merchants: what kind of store the theme suits, what it does well, in plain words. Do not promise features the platform provides to every theme (checkout, SEO, payments). ## Demo store Every theme in the store has a live demo with its own categories, offers, pages, posts and menus, so merchants judge it on a store that looks finished. The data ships **inside the package**, in `demo/`: ```text demo/ ├── store.json name and language of the demo store ├── categories.json the category tree - { slug, name, parent } ├── products.json offers - slug, title, category, price, sale price, stock, descriptions ├── pages.json content pages ├── posts.json blog posts ├── menus.json menus for your placements └── presets.json colour variants ``` The demo data is never copied into a merchant's store when they install the theme. Product photos in the demo are drawn by the platform from your theme colours, so the package does not carry stock images. `presets.json` lists colour variants of the theme - `{ id, name, settings }` with values for your colour settings. The listing shows them as swatches and the demo switches between them with `?preset=<id>`, without separate stores. The demo store is read-only: visitors can browse and use the cart, nothing else saves. Pages carry `noindex` and an "Add to store" bar. ## Versions Every package version has a [semantic version](https://semver.org/) in `theme.json`. Versions are never overwritten or deleted; a broken one can be withdrawn (yanked) so nobody new installs it. - **Patch** (`1.4.1`) - fixes that change nothing a merchant set. - **Minor** (`1.5.0`) - new sections, blocks or settings with defaults, nothing removed. - **Major** (`2.0.0`) - anything that changes the settings schema or the layout in a way that needs the merchant's attention. ## Updates in stores Publishing a version changes nothing in any store by itself. Then: - A store whose copy of the theme was **not edited** moves to the newest patch or minor version automatically - straight to the newest, skipping the ones in between. - A copy the merchant **edited** in code never updates by itself. - A **major** version is always a button the merchant presses. - The merchant can switch automatic updates off, and "reset to the package version" puts a copy back under them. Settings survive updates: values the merchant set are kept, new settings get your defaults. See [Settings](settings.md#updates). ## Trials and licences A paid theme installs into any store **as a trial**. The merchant can see it in their library and preview it on their own products and data, but cannot customize, edit or publish it - the buttons say "Buy" instead. Buying gives a licence **for that store**: - the licence belongs to the store, not to the merchant's account, and survives uninstalling the theme, - every copy of the theme in that store (duplicates included) becomes editable and publishable, - an expired subscription keeps the theme live - the store only stops receiving updates. In a development store every theme is fully usable, so you can build and test paid themes there. ## Free themes `"pricing": { "model": "free" }`, or no `pricing` at all. A free theme installs, customizes and publishes in any store. --- # Review checklist Source: https://shopdepot.dev/docs/themes/checklist/ Use this list before every submission. Most of it is about the merchant who will live with your theme for years, and their customers. ## Package - [ ] `theme.json` has `name`, a final `handle`, a new `version`, `author`, `description`, `summary`, `catalog` and `pricing`. - [ ] The upload lists **no skipped files** - every path is lowercase, at most four levels deep, binaries only in `assets/`. - [ ] No unused files, no source maps, no `node_modules` output in `assets/`. - [ ] Fonts and images are licensed for redistribution with a theme. ## Pages - [ ] Every page type has a template: `index`, `product`, `category`, `page`, `blog`, `article`, `search`, `cart`, `contact`, `terms`, `term`, `404`. - [ ] Pages work with long titles, many variants, no image, one image, out-of-stock offers, offers on sale and empty categories. - [ ] Prices use `|money`; sale prices show the regular price and the lowest price of 30 days where the merchant shows it. - [ ] The cart page uses `cart_summary()`; the contact page uses `form('contact')`. - [ ] The 404 page offers a way back - search, the menu, the home page. ## Merchant experience - [ ] Every section a merchant should add has a preset; names and labels are translated with `t:` keys. - [ ] Settings have sensible defaults - a freshly installed theme looks finished. - [ ] Setting `id`s are stable compared to the previous version. - [ ] Content images are settings, not files in `assets/`. - [ ] Menus and widgets the theme needs are declared in `theme.json`. ## Platform contracts - [ ] `snippets/brand-tokens.twig` sets every required token and nothing but custom properties and font declarations. - [ ] `assets/img/logo.svg` exists as the logo fallback. - [ ] The layout prints `{{ content_for_header }}` in `<head>` and adds no description, canonical or Open Graph tags of its own. - [ ] Sections print `section.attributes`, blocks `block.attributes`. - [ ] An out-of-stock product shows a [back-in-stock form](javascript-apis.md#back-in-stock-alerts) instead of a disabled "Add to cart" button. ## Caching and performance - [ ] No visitor-specific data in sections: the cart count, wishlist and account state come from the JSON APIs. - [ ] The first visible image has `fetchpriority="high"` or `loading="eager"`; images have dimensions or an aspect ratio. - [ ] Menus with many categories load deeper levels on demand. - [ ] No third-party scripts in the theme. Scripts are deferred modules. - [ ] Links end with a slash. ## Accessibility - [ ] The [accessibility baseline](accessibility.md) holds with the default settings and every colour preset. ## Listing - [ ] `demo/` holds a believable store for the theme's audience, and `presets.json` the colour variants you advertise. - [ ] The listing describes what the theme does, not what every ShopDepot store does. --- # Reference Source: https://shopdepot.dev/docs/reference/ These pages are generated from the platform code by `bin/console app:dev:reference`, with descriptions kept in the documentation. If a field, filter or function is not here, a theme cannot use it. ## Twig | Page | What it covers | | --- | --- | | [Objects](objects/index.md) | The data a theme reads: `shop`, `product`, `cart`, `category`, `menu`, `section`, `block` and the rest - every field with its type. | | [Filters](filters.md) | `money`, `image_url`, `asset_url`, `t` and the allowed Twig filters. | | [Functions](functions.md) | `content_for`, `render`, `sections`, `render_widget`, the platform components and the data queries. | | [Tags](tags.md) | The allowed Twig tags and the theme tags `schema`, `stylesheet`, `javascript`, `doc`. | ## Theme files | Page | What it covers | | --- | --- | | [Page types](page-types.md) | Each page a theme renders, its template, address and variables. | | [Setting types](setting-types.md) | Every input type for schemas and what the template receives. | | [Core sections and blocks](core-sections.md) | The library every theme gets, with settings. | ## Conventions - **Names are camelCase**: `product.featuredMedia`, `cart.itemCount`. - **Money is in minor units**: `12900` is 129.00 - format with [`money`](filters.md#money). - **Lists may be empty, single objects may be null**: write templates for both. - **Everything is read-only**: objects have no methods that change data. Changes go through the [JavaScript APIs](../themes/javascript-apis.md) and platform forms. --- # Objects Source: https://shopdepot.dev/docs/reference/objects/ <!-- Generated by `bin/console app:dev:reference` from the platform code and docs/dev/_data/. Do not edit by hand. --> A theme never touches the database. It reads **objects** the platform hands over: read-only views that load data only when a template asks for it, so an unused field costs nothing. Fields are read with a dot - `product.featuredMedia` - and names are camelCase. Prices are integers in minor units (grosze, cents): format them with [`money`](../filters.md#money). | Object | Description | Available on | | --- | --- | --- | | [`shop`](shop.md) | The store the page belongs to. | every page (global) | | [`cart`](cart.md) | The cart. | every page (global), [cart page](../page-types.md#cart) | | [`cart_line`](cart-line.md) | One line of the cart - an offer variant with a quantity. | [cart page](../page-types.md#cart) | | [`product`](product.md) | An offer - what a customer buys in this store. | [offer page](../page-types.md#product), [home page](../page-types.md#index), [category page](../page-types.md#category), [feature value page](../page-types.md#term), [search](../page-types.md#search), settings that point at it | | [`variant`](variant.md) | One buyable combination of the offer's options. | [offer page](../page-types.md#product) | | [`media`](media.md) | A picture or video from an offer gallery. | [offer page](../page-types.md#product) | | [`file`](file.md) | A file from the store's media library - what an `image_picker`, `file_picker` or `video` setting returns. | settings that point at it | | [`category`](category.md) | A store category. | [category page](../page-types.md#category), [home page](../page-types.md#index), settings that point at it | | [`menu`](menu.md) | A store menu - what a `link_list` setting returns. | settings that point at it | | [`link`](link.md) | One link of a menu, with its submenu and an optional mega-menu panel. | settings that point at it | | [`page`](page.md) | A content page of the store (About us, Shipping and so on). | [content page](../page-types.md#page), [search](../page-types.md#search) | | [`blog`](blog.md) | The store blog. | [blog](../page-types.md#blog), [blog post](../page-types.md#article) | | [`blog_category`](blog-category.md) | A blog category. | [blog](../page-types.md#blog) | | [`article`](article.md) | A blog post. | [blog post](../page-types.md#article), [blog](../page-types.md#blog), [home page](../page-types.md#index), [search](../page-types.md#search) | | [`reviews`](reviews.md) | Reviews of an offer, from every channel the products are sold in. | [offer page](../page-types.md#product) | | [`review`](review.md) | One published review. | [offer page](../page-types.md#product), settings that point at it | | [`term`](term.md) | One value of a dictionary feature - an author, a publisher, an ingredient - with its page in the store (`templates/term.json`). | [feature value page](../page-types.md#term), [feature index](../page-types.md#terms) | | [`feature`](feature.md) | The index page of a dictionary feature (`templates/terms.json`) - all authors, all brands and so on. | [feature index](../page-types.md#terms), [feature value page](../page-types.md#term) | | [`widget`](widget.md) | A named, configured instance of a section type - what a `widget` setting returns. | settings that point at it | | [`section`](section.md) | The section being rendered. | every section file | | [`block`](block.md) | The block being rendered. | every block file | --- # Filters Source: https://shopdepot.dev/docs/reference/filters/ <!-- Generated by `bin/console app:dev:reference` from the platform code and docs/dev/_data/. Do not edit by hand. --> Filters change a value: `{{ product.price|money }}`. Arguments go in parentheses, by position or by name - `{{ image|image_url(width: 800) }}`. A filter that is not listed here does not exist in a theme: the template fails to save. ## ShopDepot ### `money` Formats an amount in minor units (grosze, cents) as a price in the store language - `12900` becomes `129,00 zł`. Every price on an object is in minor units. ```twig {{ amount|money(currency = shop.currency) }} ``` Example: ```twig {{ product.price|money }} ``` ### `money_with_currency` Like `money`, with the ISO currency code appended - for stores that sell in several currencies. ```twig {{ amount|money_with_currency(currency = shop.currency) }} ``` Example: ```twig {{ cart.totalPrice|money_with_currency }} ``` ### `image_url` Address of an image at a width. Accepts a media object, a file from a setting or a plain address. The platform keeps WebP renditions from 320 to 2400 pixels wide and returns the smallest that covers the width; the heavy original is never sent to visitors. ```twig {{ image|image_url(width = 800) }} ``` Example: ```twig {{ product.featuredMedia|image_url(width: 1600) }} ``` ### `image_tag` An `<img>` tag with `decoding="async"`. Images are lazy by default; give the first visible image `loading: 'eager'` so it does not wait, and the main image above the fold (the LCP image) `fetchpriority: 'high'` so the browser fetches it before everything else. For an address from `image_url` the tag also gets a `srcset` with every rendition of the image, so give it an honest `sizes` (the width the image takes on the page) and the browser downloads only what the screen needs. ```twig {{ url|image_tag(alt = '', loading = 'lazy', sizes = '100vw', class = null, width = null, height = null, fetchpriority = null) }} ``` Example: ```twig {{ product.featuredMedia|image_url(width: 800)|image_tag(alt: product.title, loading: 'eager') }} ``` ### `asset_url` Address of a file in the theme's `assets/` directory, by its path inside `assets/`. The address contains the theme fingerprint, so browsers cache it for a year and a new theme version is fetched right away. A PNG or JPG gets a WebP copy when its file is saved (install, update, upload) and the address points at that copy whenever it is smaller - keep writing `'img/photo.jpg'|asset_url`. ```twig {{ 'path/in/assets'|asset_url }} ``` Example: ```twig {{ 'css/base.css'|asset_url }} ``` ### `stylesheet_tag` A `<link rel="stylesheet">` tag for an address. ```twig {{ url|stylesheet_tag }} ``` Example: ```twig {{ 'css/base.css'|asset_url|stylesheet_tag }} ``` ### `script_tag` A deferred `<script>` tag for an address, a module by default. ```twig {{ url|script_tag(type = 'module') }} ``` Example: ```twig {{ 'js/theme.js'|asset_url|script_tag }} ``` ### `t` A translation from the theme's `locales/` in the store language, falling back to `*.default.json`. Parameters replace `{{ name }}` placeholders in the text. ```twig {{ 'key.path'|t(params = {}) }} ``` Example: ```twig {{ 'cart.items'|t({ count: cart.itemCount }) }} ``` ### `handleize` Lowercase, with every run of other characters replaced by a hyphen - `Summer Sale!` becomes `summer-sale`. ```twig {{ text|handleize }} ``` Example: ```twig <div id="tab-{{ group.title|handleize }}"> ``` ### `strip_html` Removes HTML tags and leaves the text. ```twig {{ html|strip_html }} ``` Example: ```twig {{ product.shortDescription|strip_html|truncate(140) }} ``` ### `truncate` Cuts text to a number of characters and appends `end` when it was cut. ```twig {{ text|truncate(length = 120, end = '…') }} ``` Example: ```twig {{ article.excerpt|truncate(160) }} ``` ## Math ### `plus` Adds a number. Kept for templates ported from Liquid; `+` works too. ```twig {{ number|plus(other) }} ``` Example: ```twig {{ forloop_index|plus(1) }} ``` ### `minus` Subtracts a number. ```twig {{ number|minus(other) }} ``` Example: ```twig {{ product.compareAtPrice|minus(product.price)|money }} ``` ### `times` Multiplies by a number. ```twig {{ number|times(other) }} ``` Example: ```twig {{ item.unitPrice|times(item.quantity)|money }} ``` ### `divided_by` Divides by a number; dividing by zero gives 0 instead of an error. ```twig {{ number|divided_by(other) }} ``` Example: ```twig {{ (product.compareAtPrice - product.price)|times(100)|divided_by(product.compareAtPrice)|round }}% ``` ## Twig filters ### `abs` Absolute value. ```twig {{ number|abs }} ``` ### `batch` Splits a list into chunks of a size - rows of a grid. ```twig {{ list|batch(size, fill = null) }} ``` ### `capitalize` First letter uppercase, the rest lowercase. ```twig {{ text|capitalize }} ``` ### `column` Values of one key from a list of hashes. ```twig {{ list|column(name) }} ``` ### `date` Formats a date - `{{ article.publishedAt|date('j F Y') }}`. ```twig {{ date|date(format = 'd.m.Y H:i') }} ``` ### `default` The value, or the fallback when it is empty or undefined. ```twig {{ value|default(fallback = '') }} ``` ### `e` Alias of `escape`. ```twig {{ value|e(strategy = 'html') }} ``` ### `escape` Escapes a value - for `html`, `html_attr`, `js`, `css` or `url`. Output is escaped as HTML automatically. ```twig {{ value|escape(strategy = 'html') }} ``` ### `filter` Keeps the items for which the arrow function is true. ```twig {{ list|filter(v => condition) }} ``` ### `first` The first item of a list or the first character of a string. ```twig {{ list|first }} ``` ### `format` sprintf-style formatting. ```twig {{ '%s of %d'|format(a, b) }} ``` ### `join` Joins a list into a string. ```twig {{ list|join(glue = '', and = null) }} ``` ### `json_encode` JSON for a value - pass data to a script with `|json_encode|e('html_attr')` in a data attribute. ```twig {{ value|json_encode }} ``` ### `keys` Keys of a hash. ```twig {{ hash|keys }} ``` ### `last` The last item. ```twig {{ list|last }} ``` ### `length` Number of items or characters. ```twig {{ list|length }} ``` ### `lower` Lowercase. ```twig {{ text|lower }} ``` ### `map` Transforms every item with an arrow function. ```twig {{ list|map(v => expression) }} ``` ### `merge` Merges lists or hashes. ```twig {{ hash|merge(other) }} ``` ### `nl2br` Line breaks to `<br>` - for plain text fields shown on several lines. ```twig {{ text|nl2br }} ``` ### `number_format` Formats a number. Use `money` for prices. ```twig {{ number|number_format(decimals, point, thousands) }} ``` ### `raw` Prints without escaping. Only for HTML the platform already sanitised: descriptions, page content, rich text settings. ```twig {{ html|raw }} ``` ### `reduce` Folds a list into one value. ```twig {{ list|reduce((carry, v) => expression, initial) }} ``` ### `replace` Replaces substrings. ```twig {{ text|replace({ from: to })) }} ``` ### `reverse` Reverses a list or a string. ```twig {{ list|reverse }} ``` ### `round` Rounds a number. ```twig {{ number|round(precision = 0, method = 'common') }} ``` ### `slice` A part of a list or a string. ```twig {{ list|slice(start, length) }} ``` ### `sort` Sorts a list. ```twig {{ list|sort((a, b) => a <=> b) }} ``` ### `split` Splits a string into a list. ```twig {{ text|split(delimiter, limit) }} ``` ### `striptags` Twig's own tag stripping - same purpose as `strip_html`. ```twig {{ html|striptags }} ``` ### `title` Every word capitalised. ```twig {{ text|title }} ``` ### `trim` Removes whitespace from both ends. ```twig {{ text|trim }} ``` ### `upper` Uppercase. ```twig {{ text|upper }} ``` ### `url_encode` Encodes a value for a URL, a hash becomes a query string. ```twig {{ value|url_encode }} ``` --- # Functions Source: https://shopdepot.dev/docs/reference/functions/ <!-- Generated by `bin/console app:dev:reference` from the platform code and docs/dev/_data/. Do not edit by hand. --> Functions are called on their own: `{{ content_for('blocks') }}`. Data functions always read the current store, so a section never sees another store's data. ## Rendering ### `content_for` Renders the blocks of the current section or block, in the merchant's order. Use it where the blocks go; the platform adds the editor attributes and the block wrappers. ```twig {{ content_for('blocks') }} ``` Example: ```twig <div class="hero__content">{{ content_for('blocks') }}</div> ``` ### `render` Renders a snippet by file name. The snippet sees only the variables you pass plus the globals `shop`, `settings` and `cart` - variables of the calling file do not leak in. A missing snippet renders nothing. ```twig {{ render('snippet-name', variables = {}) }} ``` Example: ```twig {{ render('product-card', { product: item, show_rating: true }) }} ``` ### `render_widget` Renders a widget from a `widget` setting, or by its handle or placement name. An empty placement renders nothing. ```twig {{ render_widget(widget) }} ``` Example: ```twig {{ render_widget(section.settings.testimonials) }} ``` ### `sections` Renders a section group - `sections/<name>.json`. Used in the layout for the header and the footer. ```twig {{ sections('header-group') }} ``` Example: ```twig {{ sections('footer-group') }} ``` ### `placeholder_svg` A neutral SVG placeholder for an empty image slot in the editor. ```twig {{ placeholder_svg(name = 'product', class = null) }} ``` Example: ```twig {{ placeholder_svg('image', 'card__placeholder') }} ``` ## Platform components ### `cart_summary` The cart summary of the platform: coupon, discounts, delivery from the cheapest method, total, VAT line and the checkout button. Use it on the cart page and style its `sd-cart-summary__*` classes. ```twig {{ cart_summary() }} ``` Example: ```twig <aside class="cart__summary">{{ cart_summary() }}</aside> ``` ### `form` A platform form. Today `contact`: fields, consents, validation and sending are the platform's; the theme passes CSS classes, the button label, and optionally a fixed subject, which optional fields to show and extra fields. See [Platform pages and components](../themes/platform-pages.md#the-contact-form). ```twig {{ form('contact', options = {}) }} ``` Example: ```twig {{ form('contact', { submit: 'Send message' }) }} ``` ## Data ### `query_products` Offers of the current store for a section that is not given a list by the page. Sources - `newest` (the default), `bestsellers` (units sold in 90 days, filled up with newest offers), `top_selling` (only offers that sold - for a "Bestseller" badge), `sale` and `preorder` (offers with a variant in pre-order, the nearest shipping date first). `category` narrows any source to a store category (an object from a setting, an id or a handle). ```twig {{ query_products(source = 'newest', category = null, limit = 8) }} ``` Example: ```twig {% for product in query_products('bestsellers', null, 4) %}{{ render('product-card', { product: product }) }}{% endfor %} ``` ### `query_posts` The latest published blog posts, optionally from a blog category path, without a post handle. ```twig {{ query_posts(limit = 3, category = null, exclude = null) }} ``` Example: ```twig {% for article in query_posts(3) %}{{ render('article-card', { article: article }) }}{% endfor %} ``` ### `query_post` One published post by its handle, or null. ```twig {{ query_post(handle) }} ``` ### `query_terms` Values of a dictionary feature by the address of its feature page - all, or only the listed handles; `with_image` keeps values with a picture in this store; `order` is `name` or `offers`. ```twig {{ query_terms(feature, limit = 12, handles = null, with_image = false, order = 'name', exclude = null) }} ``` Example: ```twig {% for brand in query_terms('brands', 12, null, true) %}…{% endfor %} ``` ### `query_categories` Subcategories of a category, or the top-level categories of the store without a parent. ```twig {{ query_categories(parent = null, limit = 12) }} ``` Example: ```twig {% for category in query_categories(null, 6) %}…{% endfor %} ``` ### `product_terms` The values of a dictionary feature on one offer - authors under a title, for example. ```twig {{ product_terms(product, feature) }} ``` Example: ```twig {% for author in product_terms(product, 'authors') %}<a href="{{ author.url }}">{{ author.title }}</a>{% endfor %} ``` ### `query_term_products` Other offers sharing a dictionary value with this offer - "More from this author". ```twig {{ query_term_products(product, feature, limit = 8) }} ``` ## Addresses ### `url_for` A store address, with the trailing slash every store address has. Routes - `home`, `cart`, `search`, `account`, `wishlist`, `blog`, and with a `handle` - `product`, `category`, `article`, `page`. ```twig {{ url_for(route, params = {}) }} ``` Example: ```twig <a href="{{ url_for('cart') }}">Cart</a> ``` ## Twig functions ### `date` A date object to compare with or format. ```twig {{ date(value = 'now') }} ``` ### `include` Includes another theme file with the current variables. Prefer `render()`, which isolates variables. ```twig {{ include(template, variables = {}) }} ``` ### `max` The largest value. ```twig {{ max(a, b, …) }} ``` ### `min` The smallest value. ```twig {{ min(a, b, …) }} ``` ### `random` A random item. Avoid it in cached markup: the page is built once and shown to everyone. ```twig {{ random(values) }} ``` ### `range` A list of numbers - `{% for i in range(1, 5) %}`. ```twig {{ range(low, high, step = 1) }} ``` --- # Tags Source: https://shopdepot.dev/docs/reference/tags/ <!-- Generated by `bin/console app:dev:reference` from the platform code and docs/dev/_data/. Do not edit by hand. --> Tags are logic: `{% if %}`, `{% for %}`. Everything that is not listed - `extends`, `block`, `macro`, `import`, `use`, `sandbox`, `deprecated` and the rest - is refused by the sandbox. ## Theme ### `schema` The JSON schema of a section or block - its name, settings, nested blocks and presets. Required in a block, forbidden in a snippet. It never renders. ```twig {% schema %} { … } {% endschema %} ``` ### `stylesheet` CSS of a section or block. The platform collects every stylesheet of the theme into one file (`_sections.css`) linked in `content_for_header`, so the CSS loads once however many times the section appears. ```twig {% stylesheet %} … {% endstylesheet %} ``` ### `javascript` JavaScript of a section or block, collected into `_sections.js` the same way as stylesheets. The platform does not link that file for you - prefer a module in `assets/`, or add `{{ '_sections.js'|asset_url|script_tag }}` to the layout. ```twig {% javascript %} … {% endjavascript %} ``` ### `doc` Documentation of a snippet or block - its parameters. It never renders. ```twig {% doc %} @param name - description {% enddoc %} ``` ## Twig tags ### `apply` Applies filters to a block of output. ```twig {% apply upper %}…{% endapply %} ``` ### `do` Evaluates an expression without printing it. ```twig {% do expression %} ``` ### `else` Part of `if` and `for`. ```twig {% else %} ``` ### `elseif` Part of `if`. ```twig {% elseif condition %} ``` ### `for` Loops, with `loop.index`, `loop.first`, `loop.last`; the `else` part runs for an empty list. ```twig {% for item in list %}…{% else %}…{% endfor %} ``` ### `if` Conditions. ```twig {% if condition %}…{% elseif other %}…{% else %}…{% endif %} ``` ### `set` Assigns a variable. ```twig {% set name = value %} ``` ### `verbatim` Outputs Twig syntax unparsed - for client-side templates. ```twig {% verbatim %}…{% endverbatim %} ``` ### `with` A scope with its own variables. ```twig {% with { name: value } only %}…{% endwith %} ``` --- # Page types Source: https://shopdepot.dev/docs/reference/page-types/ <!-- Generated by `bin/console app:dev:reference` from the platform code and docs/dev/_data/. Do not edit by hand. --> Each page type is drawn from a JSON template in `templates/`. The template lists the sections of the page; every section on the page sees the variables below. See [Templates](../themes/templates.md) for the template format. ## Global variables Available on every page, in the layout, in every section and block. | Variable | Type | Description | | --- | --- | --- | | `shop` | [`shop`](objects/shop.md) | The store. | | `settings` | hash | Values of the theme settings (`config/settings_schema.json`), resolved. | | `cart` | [`cart`](objects/cart.md) | An empty cart outside the cart page - pages are cached for everyone, read the live cart with `/cart.js`. | | `template` | string | The page type, for example `product` - for a class on `<body>`. | | `template_suffix` | string | The alternate template in use (`mask` for `product.mask.json`, `books` for `category.books.json`), null for the default one. | | `page_title` | string | The title of the page content, without the store name. | | `seo_title` | string | The full document title from the store's SEO templates. The platform puts it in `<title>` for you. | | `content_for_header` | html | Layout only. Platform markup for `<head>`: meta tags, canonical, Open Graph, the section stylesheet, preconnects, scripts the merchant added. Print it in `<head>`. | | `content_for_layout` | html | Layout only. The rendered sections of the page template. | ## index - Template: `templates/index.json` - Address: `/` | Variable | Type | Description | | --- | --- | --- | | `products` | list of [`product`](objects/product.md) | The store's offers, as sorted and limited in the store's product settings. | | `articles` | list of [`article`](objects/article.md) | The three latest blog posts. | | `categories` | list of [`category`](objects/category.md) | The top-level store categories. | ## product - Template: `templates/product.json` - Address: `/products/<handle>/` - Alternate templates: `product.<suffix>.json` - the merchant picks the template on the offer. | Variable | Type | Description | | --- | --- | --- | | `product` | [`product`](objects/product.md) | The offer. Its `reviews` and `optionFields` are filled only here. | | `recommendations` | list of [`product`](objects/product.md) | Up to eight offers from the same store categories, filled up with the newest. | ## category - Template: `templates/category.json` - Address: `/categories/<handle>/` - Alternate templates: `category.<suffix>.json` - the merchant picks the template on the category. Subcategories keep their own choice. | Variable | Type | Description | | --- | --- | --- | | `category` | [`category`](objects/category.md) | The category, with `children`, `siblings`, `filters` and the offers of this page. | | `products` | list of [`product`](objects/product.md) | The offers of the current page. | | `pagination` | hash | `page`, `pages`, `total` and `per_page`. | | `sort` | string | The sort in use. | | `sort_options` | list of string | Sorts a customer can choose: `newest`, `popularity`, `rating`, `price_asc`, `price_desc`, `name`. | ## page - Template: `templates/page.json` - Address: `/<path>/` - Alternate templates: `page.<last segment of the path>.json` - `/contact-us/` uses `page.contact-us.json` when the theme has it. | Variable | Type | Description | | --- | --- | --- | | `page` | [`page`](objects/page.md) | The content page. | ## blog - Template: `templates/blog.json` - Address: `/blog/ and /blog/<category path>/` | Variable | Type | Description | | --- | --- | --- | | `blog` | [`blog`](objects/blog.md) | The blog. | | `blog_category` | [`blog_category`](objects/blog-category.md) | The category on a category page, null on the blog home. | | `articles` | list of [`article`](objects/article.md) | The posts of the current page. | | `pagination` | hash | `page`, `pages`, `total` and `per_page`. | | `sort` | string | The sort in use. | ## article - Template: `templates/article.json` - Address: `/blog/<handle>/` | Variable | Type | Description | | --- | --- | --- | | `blog` | [`blog`](objects/blog.md) | The blog. | | `article` | [`article`](objects/article.md) | The post. | | `articles` | list of [`article`](objects/article.md) | Related posts. | | `previous_article` | [`article`](objects/article.md) | The older neighbour, null for the first post. | | `next_article` | [`article`](objects/article.md) | The newer neighbour, null for the latest post. | ## terms - Template: `templates/terms.json` - Address: `/<feature page>/` - Alternate templates: `terms.<feature code>.json` - for example `terms.authors.json`. | Variable | Type | Description | | --- | --- | --- | | `feature` | [`feature`](objects/feature.md) | The feature index - values, alphabet, search and pagination. | ## term - Template: `templates/term.json` - Address: `/<feature prefix>/<handle>/` - Alternate templates: `term.<feature code>.json`. | Variable | Type | Description | | --- | --- | --- | | `term` | [`term`](objects/term.md) | The value with its offers and listing filters. | | `pagination` | hash | `page`, `pages`, `total` and `per_page`. | | `sort` | string | The sort in use. | ## search - Template: `templates/search.json` - Address: `/search/?q=<terms>` | Variable | Type | Description | | --- | --- | --- | | `search` | hash | `terms`, `performed`, `resultsCount`, `productsCount`, `products`, `pages` and `articles` (pages and posts on the first page only). | | `products` | list of [`product`](objects/product.md) | The matching offers of the current page. | | `pagination` | hash | `page`, `pages`, `total` and `per_page`. | | `sort` | string | The sort in use - `relevance` by default. | | `sort_options` | list of string | `relevance` and the category sorts. | ## cart - Template: `templates/cart.json` - Address: `/cart/` | Variable | Type | Description | | --- | --- | --- | | `cart` | [`cart`](objects/cart.md) | The visitor's cart. This page is never cached. | ## contact - Template: `templates/contact.json` - Address: `/contact/` Only the global variables. ## 404 - Template: `templates/404.json` - Address: `any unknown store address` Only the global variables. --- # Setting types Source: https://shopdepot.dev/docs/reference/setting-types/ <!-- Generated by `bin/console app:dev:reference` from the platform code and docs/dev/_data/. Do not edit by hand. --> A setting is declared in a schema with a `type`, an `id`, a `label` and usually a `default` - see [Settings](../themes/settings.md). The **value** column is what the template gets in `settings.<id>`, `section.settings.<id>` or `block.settings.<id>` after the platform resolves it: a `product` setting gives a [product](objects/product.md) object, never an id. An empty setting is `null`. ## Basic | Type | Value | Description | | --- | --- | --- | | `text` | string | A single line of text. | | `textarea` | string | Several lines of plain text - print with `\|nl2br`. | | `richtext` | HTML string | Formatted text from the editor. Sanitised when saved and when read, so it is safe to print with `\|raw`. | | `inline_richtext` | string | Short text for headings and button labels. Stored as plain text today and escaped on output, so formatting is not kept - print it without `\|raw`. | | `html` | HTML string | Raw HTML entered by the merchant. Sanitised like `richtext` - scripts are removed. | | `number` | number | A number; `min`, `max` and `step` are enforced when the merchant saves. | | `range` | number | A slider - requires `min`, `max` and `step`, optional `unit` shown in the editor. Values outside the range are clamped. | | `checkbox` | boolean | On or off. Without a `default` it starts off. | | `select` | string | One of `options` - a list of `{ value, label }`. A value outside the list falls back to the default. | | `url` | string | A link - an address on the store (`/contact/`) or `http(s)`, `mailto:`, `tel:`, `#`. Anything else is rejected. | ## Design | Type | Value | Description | | --- | --- | --- | | `color` | string | A colour as `#rrggbb`. An invalid value falls back to the default. | | `color_scheme` | string | One of the theme's colour schemes, as its id (for example `scheme-2`) - use it as a class. | | `font_picker` | string | A font chosen from the theme's list, as its identifier. | ## Media | Type | Value | Description | | --- | --- | --- | | `image_picker` | [`file`](objects/file.md) | An image from the store's media library. Pass the value to `\|image_url`. | | `file_picker` | [`file`](objects/file.md) | Any file from the media library - a PDF catalogue, for example. | | `video` | [`file`](objects/file.md) | A video from the media library, with `posterUrl`. | ## Store data | Type | Value | Description | | --- | --- | --- | | `product` | [`product`](objects/product.md) | One offer of the store. | | `product_list` | list of [`product`](objects/product.md) | Several offers in the merchant's order. Offers removed later drop out of the list. | | `category` | [`category`](objects/category.md) | One store category. | | `category_list` | list of [`category`](objects/category.md) | Several store categories. | | `link_list` | [`menu`](objects/menu.md) | A store menu. The value is a menu handle or the name of a menu placement the theme declares in `theme.json` - the merchant assigns menus to placements. | | `widget` | [`widget`](objects/widget.md) | A widget - a named, reusable instance of a section. Render it with `render_widget()`. | | `store_reviews` | list of [`review`](objects/review.md) | The latest published reviews of the store. Always a list, also an empty one; `limit` sets how many. The merchant does not pick anything - there is no field in the editor. | ## Editor only | Type | Value | Description | | --- | --- | --- | | `header` | none | A heading between settings in the editor. Needs `content`, has no value. | | `paragraph` | none | A paragraph of help text in the editor. Needs `content`, has no value. | --- # Core sections and blocks Source: https://shopdepot.dev/docs/reference/core-sections/ <!-- Generated by `bin/console app:dev:reference` from the platform code and docs/dev/_data/. Do not edit by hand. --> These files live in the platform, under every theme. They work in any theme because they style themselves only with the [brand tokens](../themes/platform-pages.md#brand-tokens). A theme changes how one looks by shipping a file with the **same name** - `sections/faq.twig` replaces the core `faq` - and then the core CSS of that section is not loaded. See [Sections and blocks](../themes/sections-and-blocks.md#the-core-library). ## Sections ### `banner` A wide image band with a heading, text and a button over or beside the picture. Blocks: `@theme`. | Setting | Type | Default | Label | | --- | --- | --- | --- | | `image` | `image_picker` | | Background image | | `height` | `range` | `420` | Height | | `overlay` | `range` | `40` | Overlay | | `align` | `select` | `"center"` | Alignment | ### `callout` A highlighted box for a short message - a guarantee, a note, a promise. Blocks: `@theme`. | Setting | Type | Default | Label | | --- | --- | --- | --- | | `background` | `select` | `"soft"` | Background | | `align` | `select` | `"center"` | Alignment | | `spacing` | `range` | `56` | Spacing | ### `contact-form` A heading and text with the platform's contact form (`form('contact')`). Fields and consents are set in the store settings. | Setting | Type | Default | Label | | --- | --- | --- | --- | | `heading` | `text` | `"Contact us"` | Heading | | `text` | `textarea` | `"Questions about an order or a product? Write to us - we reply by e-mail."` | Text | | `button_label` | `text` | | Button label | ### `content` A plain content band - text, images, lists. The default section of a new page. Blocks: `@theme`. | Setting | Type | Default | Label | | --- | --- | --- | --- | | `width` | `select` | `"normal"` | Width | | `background` | `select` | `"none"` | Background | | `spacing` | `range` | `40` | Spacing | ### `faq` A heading with questions shown as `<details>`, without JavaScript, and optional FAQ structured data. Blocks: `faq-item`. | Setting | Type | Default | Label | | --- | --- | --- | --- | | `number` | `text` | | Section number | | `heading` | `text` | `"Frequently asked questions"` | Heading | | `text` | `textarea` | | Text | | `layout` | `select` | `"split"` | Layout | | `schema_markup` | `checkbox` | `true` | Add FAQ structured data for Google | | `background` | `select` | `"none"` | Background | ### `hero-tiles` A hero with heading, text and button, beside two to six tiles (block `tile`) leading to categories, campaigns or offers. Blocks: `tile`. | Setting | Type | Default | Label | | --- | --- | --- | --- | | `heading` | `text` | `"Everything you need in one place"` | Heading | | `text` | `textarea` | | Text | | `button_label` | `text` | `"Shop now"` | Button label | | `button_url` | `text` | `"/categories/all/"` | Button URL | | `background` | `select` | `"soft"` | Background | ### `logo-wall` A band of logos the merchant uploads (block `logo`) - partners, press, certificates, payment methods. Blocks: `logo`. | Setting | Type | Default | Label | | --- | --- | --- | --- | | `heading` | `text` | | Heading | | `columns` | `range` | `6` | Columns | | `grayscale` | `checkbox` | `true` | Grayscale until hovered | | `background` | `select` | `"none"` | Background | ### `media-text` An image or video beside text, either side. Blocks: `@theme`. | Setting | Type | Default | Label | | --- | --- | --- | --- | | `image` | `image_picker` | | Image | | `side` | `select` | `"start"` | Image side | | `background` | `select` | `"none"` | Background | | `spacing` | `range` | `40` | Spacing | ### `newsletter` Newsletter sign-up of the store with double opt-in. Works without JavaScript and sends in the background with it. | Setting | Type | Default | Label | | --- | --- | --- | --- | | `heading` | `text` | `"Subscribe to our newsletter"` | Heading | | `text` | `textarea` | `"News, offers and tips - no more than once a week."` | Text | | `placeholder` | `text` | `"Your e-mail address"` | Field placeholder | | `button_label` | `text` | `"Subscribe"` | Button label | | `note` | `richtext` | | Note under the form | | `background` | `select` | `"accent"` | Background | ### `placeholder-section` Stands in for a section type the current theme does not know, keeping its settings until the type is back. | Setting | Type | Default | Label | | --- | --- | --- | --- | | `type` | `text` | | Type | ### `post-list` The latest blog posts of the store as cards. | Setting | Type | Default | Label | | --- | --- | --- | --- | | `heading` | `text` | `"From the blog"` | Heading | | `limit` | `range` | `3` | Number of posts | | `columns` | `range` | `3` | Columns | | `show_excerpt` | `checkbox` | `true` | Show excerpt | | `show_date` | `checkbox` | `false` | Show date | | `background` | `select` | `"none"` | Background | | `link_label` | `text` | `"All posts"` | Link label | | `link_url` | `text` | `"/blog/"` | Link URL | ### `product-list` Offers from a source - newest, bestsellers, sale or a store category - as a grid or a carousel. Cards come from the theme's `product-card` snippet. | Setting | Type | Default | Label | | --- | --- | --- | --- | | `heading` | `text` | `"Bestsellers"` | Heading | | `text` | `text` | | Subheading | | `source` | `select` | `"bestsellers"` | Products | | `category` | `category` | | Category | | `limit` | `range` | `8` | Number of products | | `layout` | `select` | `"carousel"` | Layout | | `columns` | `range` | `5` | Columns | | `background` | `select` | `"none"` | Background | | `link_label` | `text` | | Link label | | `link_url` | `text` | | Link URL | ### `term-grid` Values of a feature page - authors, publishers, brands - as portraits or a logo band. | Setting | Type | Default | Label | | --- | --- | --- | --- | | `heading` | `text` | `"Featured authors"` | Heading | | `feature` | `text` | `"authors"` | Feature page address | | `terms` | `textarea` | | Values to show | | `limit` | `range` | `12` | Number of values | | `with_image` | `checkbox` | `true` | Only values with a photo or logo | | `style` | `select` | `"portraits"` | Style | | `columns` | `range` | `6` | Columns | | `background` | `select` | `"none"` | Background | | `link_label` | `text` | `"See all"` | Link label | | `link_url` | `text` | | Link URL | ### `testimonials` The latest published store reviews (never filtered by rating), or quotes entered as `testimonial` blocks. Blocks: `testimonial`. | Setting | Type | Default | Label | | --- | --- | --- | --- | | `heading` | `text` | `"What customers say"` | Heading | | `text` | `text` | | Subheading | | `source` | `select` | `"reviews"` | Source | | `reviews` | `store_reviews` | | Reviews | | `note` | `text` | `"Reviews marked ✓ come from verified purchases in our store."` | Note under reviews | | `columns` | `range` | `3` | Columns | | `background` | `select` | `"soft"` | Background | ## Blocks ### `button` A link styled as a button. | Setting | Type | Default | Label | | --- | --- | --- | --- | | `label` | `text` | `"Button"` | Label | | `url` | `url` | | Link | | `style` | `select` | `"primary"` | Style | | `align` | `select` | `"start"` | Alignment | ### `columns` Columns - their number follows the blocks inside, the setting changes proportions and gap. Blocks: `@theme`. | Setting | Type | Default | Label | | --- | --- | --- | --- | | `ratio` | `select` | `"equal"` | Proportions | | `gap` | `range` | `24` | Gap | | `stack` | `checkbox` | `true` | Stack on mobile | ### `divider` A horizontal rule. | Setting | Type | Default | Label | | --- | --- | --- | --- | | `style` | `select` | `"line"` | Style | ### `faq-item` One question and answer of the `faq` section. | Setting | Type | Default | Label | | --- | --- | --- | --- | | `question` | `text` | | Question | | `answer` | `richtext` | | Answer | | `open` | `checkbox` | `false` | Open by default | ### `heading` A heading. The merchant picks the level; `h1` is left to the page title. | Setting | Type | Default | Label | | --- | --- | --- | --- | | `text` | `text` | `"Heading"` | Text | | `level` | `select` | `"h2"` | Level | | `align` | `select` | `"start"` | Alignment | ### `html` The merchant's own HTML, sanitised when saved - no scripts or event handlers. | Setting | Type | Default | Label | | --- | --- | --- | --- | | `code` | `textarea` | | Code | ### `image` An image from the media library with optional link and caption. | Setting | Type | Default | Label | | --- | --- | --- | --- | | `image` | `image_picker` | | File | | `alt` | `text` | | Alternative text | | `caption` | `text` | | Caption | | `url` | `url` | | Link | | `width` | `select` | `"content"` | Width | ### `list` A bulleted, numbered or check-mark list; one line is one item. | Setting | Type | Default | Label | | --- | --- | --- | --- | | `items` | `textarea` | `"First\nSecond"` | Items (one per line) | | `style` | `select` | `"bulleted"` | Style | ### `logo` One logo of the `logo-wall` section. | Setting | Type | Default | Label | | --- | --- | --- | --- | | `image` | `image_picker` | | Logo | | `alt` | `text` | | Name (alternative text) | | `url` | `text` | | Link | ### `paragraph` Formatted text from the editor, sanitised when saved. | Setting | Type | Default | Label | | --- | --- | --- | --- | | `text` | `richtext` | `"<p>Text</p>"` | Content | | `size` | `select` | `"md"` | Size | ### `placeholder` Stands in for a block type the current theme does not know. | Setting | Type | Default | Label | | --- | --- | --- | --- | | `type` | `text` | | Type | ### `quote` A quotation with an optional author. | Setting | Type | Default | Label | | --- | --- | --- | --- | | `text` | `textarea` | `"Quote"` | Text | | `author` | `text` | | Author | ### `spacer` Vertical space. | Setting | Type | Default | Label | | --- | --- | --- | --- | | `size` | `range` | `32` | Height | ### `testimonial` One quote of the `testimonials` section. | Setting | Type | Default | Label | | --- | --- | --- | --- | | `quote` | `textarea` | | Quote | | `name` | `text` | | Name / caption | | `rating` | `range` | `` | Stars | | `photo` | `image_picker` | | Photo | ### `tile` One tile of the `hero-tiles` section. | Setting | Type | Default | Label | | --- | --- | --- | --- | | `title` | `text` | | Title | | `text` | `text` | | Text | | `url` | `text` | | Link | | `image` | `image_picker` | | Image | | `tone` | `select` | `"light"` | Style | --- # Changelog Source: https://shopdepot.dev/docs/changelog/ ## 30 November 2026 - Documented [back-in-stock alerts](themes/javascript-apis.md#back-in-stock-alerts): `POST /back-in-stock/subscribe.js` and `/back-in-stock/subscribe/` save a "notify me" sign-up from an out-of-stock product page, and the platform e-mails the visitor when the product can be bought again. The endpoints already worked; they were missing from these docs. ## 29 November 2026 - Footer menus with nested links: in the `base` theme (1.19.0) a top-level link that has sub-links becomes its own footer column, with the link as the column heading. Links without sub-links stay in the menu column. - [`category.image`](reference/objects/category.md) - the category image set in **Catalog → Categories**, next to the icon. `children.json` gives it as `image`. The `base` theme (1.17.0) shows it as a banner on the category page. - [`category.additionalDescription`](reference/objects/category.md) - a second rich text description of the category. The `base` theme (1.18.0) shows it below the products on the first page. - A guide to the fields of a store category on its page: [The category page](themes/templates.md#the-category-page). - [`PATCH /themes/{id}`](themes/theme-api.md#patch-themesid) in the theme API marks a theme as managed outside the store (`managed_by`, for example a ShopDepot Studio draft). Package updates - nightly, the **Update** button and reset - no longer overwrite its code. The theme object has `managed_by` and `available_update`. - Writing `config/settings_data.json` through [`PUT /themes/{id}/files/{path}`](themes/theme-api.md#put-themesidfilespath) (for example `shopdepot theme push --only config/settings_data.json`) now applies its `current` values to the theme's settings in the store. Before, the file was saved, but the storefront kept the old settings. - [`GET /sample`](themes/theme-api.md#get-sample) in the theme API says what each category has: `heading`, `image`, `icon`, `icon_vector`, `has_description`, `has_additional_description`. ## 28 November 2026 - Alternate category templates: `templates/category.<suffix>.json`, chosen per store category in **Catalog → Categories**. See [Alternate templates](themes/templates.md#alternate-templates). ## 22 November 2026 - **The chat widget belongs to the platform.** When the merchant turns the chat on, it is added to every page of the theme, with its own styles. Themes no longer include it. See [The chat widget](themes/platform-pages.md#the-chat-widget). - The `<head>` gets the CSS of only the sections and blocks used on the page. The rest of `_sections.css` loads after the page has loaded, so sections added later by JavaScript still get their styles. - Theme JavaScript in `assets/*.js` is minified. Files named `*.min.js` are left as they are. ## 21 November 2026 - [`category.icon`](reference/objects/category.md) - the category icon set in **Catalog → Categories**, an image or an SVG. `children.json` gives it as `icon` and `icon_vector`. - [`category.heading`](reference/objects/category.md) - the H1 of the category page, the name when left empty. - SVG files in the media library: they are cleaned on upload (no scripts or external references) and have no renditions. [`file.vector`](reference/objects/file.md) says a file is an SVG. - Pre-orders: [`variant.stockStatus`](reference/objects/variant.md) can be `onpreorder`, with `variant.preorder` and `variant.preorderDate`; [`product.preorder`](reference/objects/product.md) and `product.preorderDate` for the variant the page shows. [`query_products('preorder')`](reference/functions.md#query_products) lists offers in pre-order, nearest shipping date first. ## 15 November 2026 - **The MCP server** at `https://shopdepot.dev/mcp`: AI assistants search and read the docs, look up reference entries and check theme files against the save rules. [Connect it](themes/ai-assistants.md#connect-the-mcp-server) to Claude, Cursor or VS Code. - **The `shopdepot` CLI.** [Install it](themes/cli.md) with `curl -fsSL https://shopdepot.dev/install.sh | sh`: `theme init`, `pull`, `push`, `dev` with a live preview, `check`, `open` and `package`. It works with developer tokens created in **Appearance → Themes → Developer access**. - **The [theme API](themes/theme-api.md)** - the HTTP API behind the CLI, for your own tooling. - Theme files written by a developer (code editor, CLI, API) are now checked against the [Twig sandbox](themes/twig-sandbox.md) when they are saved, not only when a page renders. A template that calls something the sandbox does not allow is refused with the reason. - **shopdepot.dev launched.** Guides for theme developers and a reference generated from the platform code: [objects](reference/objects/index.md), [filters](reference/filters.md), [functions](reference/functions.md), [tags](reference/tags.md), [setting types](reference/setting-types.md), [page types](reference/page-types.md) and [core sections](reference/core-sections.md). - Every page is available as Markdown (`.md` after the address), with [`/llms.txt`](/llms.txt) and [`/llms-full.txt`](/llms-full.txt) for AI assistants. - Variant pictures: [`variant.featuredMedia`](reference/objects/variant.md). Galleries show the variant picture first when a variant is chosen. - Several discount codes in one cart (up to five): `/cart/discount.js` adds a code, `remove` takes one off, and `/cart.js` lists them in `discount_codes`. In Twig: [`cart.discountCodes`](reference/objects/cart.md). See [Discount codes](themes/javascript-apis.md#discount-codes). - `image_tag` adds a `srcset` with the renditions of a media library image (320 to 2400 px). Give it an honest `sizes`. See [`image_tag`](reference/filters.md#image_tag). - PNG and JPG files in `assets/` get a WebP copy automatically, and `asset_url` serves it. See [Images that belong to the theme](themes/assets.md#images-that-belong-to-the-theme). ## 14 November 2026 - [`cart_summary()`](reference/functions.md#cart_summary) - the platform cart summary with coupon, discounts, delivery and total. Coupons apply in place and fire `shopdepot:cart:changed`. - [`form('contact')`](reference/functions.md#form) - the contact form as a platform component with stable `sd-form__*` classes, extra fields and a fixed subject. ## 13 November 2026 - Alternate product templates: `templates/product.<suffix>.json`, chosen per offer. - Page templates by address: `templates/page.<last segment>.json`. - `templates/404.json` renders the store's not found page. - [`cart.shippingFrom`](reference/objects/cart.md) and `shipping_from` in `/cart.js` - the cheapest delivery computed like checkout. - [`cart.taxTotal`](reference/objects/cart.md) - the VAT included in the cart total, for "including X tax". - Product option fields (engraving, gift wrap, size): [`product.optionFields`](reference/objects/product.md) on the product page, sent with the add-to-cart form as `properties[<field id>]`. See [Add to the cart](themes/javascript-apis.md#add-to-the-cart). - [`query_products`](reference/functions.md#query_products) takes `in_stock` to leave out offers that cannot be bought. ## 12 November 2026 - Menu levels on demand: `link.hasChildren`, `link.childrenUrl` and `/categories/<handle>/children.json`. - Feature index layout settings: `feature.layout`, `feature.showAlphabet`, `feature.showSearch`, `feature.showCount`, `feature.sort`. - The platform writes the document `<title>` from the store's SEO templates; `seo_title` is available to layouts. ## 11 November 2026 - The core section library grew into store sections: `hero-tiles`, `product-list`, `term-grid`, `logo-wall`, `newsletter`, `testimonials`, `post-list`, `faq`. A theme file with the same name replaces a core one. - Data functions [`query_products`](reference/functions.md#query_products), [`query_posts`](reference/functions.md#query_posts), [`query_terms`](reference/functions.md#query_terms). - Images without a `loading` attribute are lazy by default - give the first visible image `fetchpriority="high"`. - Storefront HTML is minified; pages are cached for all visitors. --- # article Source: https://shopdepot.dev/docs/reference/objects/article/ <!-- Generated by `bin/console app:dev:reference` from the platform code and docs/dev/_data/. Do not edit by hand. --> A blog post. Available on: [blog post](../page-types.md#article), [blog](../page-types.md#blog), [home page](../page-types.md#index), [search](../page-types.md#search). ## Properties | Property | Type | Description | | --- | --- | --- | | `article.id` | string | Post identifier. | | `article.title` | string | Post title. | | `article.handle` | string | The URL handle - `/blog/<handle>/`. | | `article.url` | string | Address of the post. | | `article.excerpt` | string | The excerpt the merchant wrote, otherwise the opening of the post. | | `article.content` | string | Post content, ready HTML. | | `article.author` | string or null | Author name. | | `article.publishedAt` | date or null | Publication date - format with `\|date`. | | `article.readingTime` | number | Reading time in whole minutes, at least 1. | | `article.image` | string or null | Address of the cover image. | | `article.category` | [`blog_category`](blog-category.md) or null | The category for the badge and breadcrumbs. Null for a post without a category. | | `article.categories` | list of [`blog_category`](blog-category.md) | All categories of the post. | | `article.seoTitle` | string or null | SEO title. | | `article.seoDescription` | string or null | Meta description. | --- # block Source: https://shopdepot.dev/docs/reference/objects/block/ <!-- Generated by `bin/console app:dev:reference` from the platform code and docs/dev/_data/. Do not edit by hand. --> The block being rendered. Available inside every block file. Available on: every block file. ## Properties | Property | Type | Description | | --- | --- | --- | | `block.id` | string | The block key. | | `block.type` | string | The block type (the file name). | | `block.settings` | hash | Values of the block settings, resolved. | | `block.blocks` | list of [`block`](block.md) | Nested blocks. | | `block.attributes` | html | Attributes the theme editor needs to select the block. Print them on the root element. | --- # blog Source: https://shopdepot.dev/docs/reference/objects/blog/ <!-- Generated by `bin/console app:dev:reference` from the platform code and docs/dev/_data/. Do not edit by hand. --> The store blog. Available on: [blog](../page-types.md#blog), [blog post](../page-types.md#article). ## Properties | Property | Type | Description | | --- | --- | --- | | `blog.url` | string | Address of the blog, `/blog/`. | | `blog.categories` | list of [`blog_category`](blog-category.md) | Top-level blog categories that have published posts. | | `blog.query` | string | The search phrase on the blog list, empty when there is none. | --- # blog_category Source: https://shopdepot.dev/docs/reference/objects/blog-category/ <!-- Generated by `bin/console app:dev:reference` from the platform code and docs/dev/_data/. Do not edit by hand. --> A blog category. Available on: [blog](../page-types.md#blog). ## Properties | Property | Type | Description | | --- | --- | --- | | `blog_category.id` | string | Category identifier. | | `blog_category.title` | string | Category name. | | `blog_category.handle` | string | The category handle. | | `blog_category.path` | string | The full path, for example `guides/shipping` - pass it to `query_posts()`. | | `blog_category.url` | string | Address of the category page. | | `blog_category.description` | string or null | Category description. | | `blog_category.seoTitle` | string or null | SEO title. | | `blog_category.seoDescription` | string or null | Meta description. | | `blog_category.depth` | number | 0 for a top-level category. | | `blog_category.parent` | [`blog_category`](blog-category.md) or null | The parent category. | | `blog_category.ancestors` | list of [`blog_category`](blog-category.md) | The path from the top-level category to the parent, for breadcrumbs. | | `blog_category.children` | list of [`blog_category`](blog-category.md) | Subcategories with published posts. | | `blog_category.hasChildren` | boolean | True when there are subcategories. | | `blog_category.siblings` | list of [`blog_category`](blog-category.md) | Categories with the same parent, this one included - tabs on a leaf category. | --- # cart Source: https://shopdepot.dev/docs/reference/objects/cart/ <!-- Generated by `bin/console app:dev:reference` from the platform code and docs/dev/_data/. Do not edit by hand. --> The cart. On the cart page (`templates/cart.json`) it holds the visitor's cart. Everywhere else it is an empty cart, because pages are cached and shared by every visitor - read the live cart with `/cart.js`. Available on: every page (global), [cart page](../page-types.md#cart). ## Properties | Property | Type | Description | | --- | --- | --- | | `cart.empty` | boolean | True when the cart has no items. | | `cart.itemCount` | number | Number of units in the cart (the sum of quantities). | | `cart.items` | list of [`cart_line`](cart-line.md) | The lines of the cart. | | `cart.subtotal` | number | Value of the items before order-level discounts and shipping, in minor units. | | `cart.discountTotal` | number | Sum of all discounts, in minor units. | | `cart.shippingTotal` | number | Shipping cost known on the cart page, in minor units. The customer picks the method in checkout. | | `cart.taxTotal` | number | VAT included in the total (items and shipping), in minor units - for "including X tax". | | `cart.totalPrice` | number | What the customer pays, in minor units. | | `cart.currency` | string or null | ISO 4217 code of the cart currency. | | `cart.note` | string or null | Always empty - the customer writes the order note in checkout. Kept so templates written for Shopify keep working. | | `cart.discountCode` | string or null | The first discount code the customer entered, if any. A cart can hold several - see `discountCodes`. | | `cart.discountCodes` | list | Every discount code in the cart, in the order they were added: a list of `{ code, applied, error }`. `applied` is true when the code gives a discount; otherwise `error` says why (threshold not met, does not combine with another code). | | `cart.discountCodeError` | string or null | Why the entered code does not apply - show it next to the coupon field. | | `cart.discounts` | list | Applied promotions: a list of `{ label, code, amount, kind }`, where `kind` is `product`, `order` or `shipping`. | | `cart.notices` | list | Threshold hints from automatic promotions: a list of `{ label, missing, unit }`; `unit` is `amount` (minor units) or `items` (pieces) - "Add 45 PLN more to get free delivery". | | `cart.freeShippingMissing` | number or null | How much is missing to free delivery, in minor units. Null when the store has no free delivery threshold. | | `cart.shippingFrom` | number or null | The cheapest delivery for this cart, computed from the store's delivery methods exactly as checkout does, in minor units. Null when no method fits. Write "Delivery from X" from this value, never from a theme setting. | --- # cart_line Source: https://shopdepot.dev/docs/reference/objects/cart-line/ <!-- Generated by `bin/console app:dev:reference` from the platform code and docs/dev/_data/. Do not edit by hand. --> One line of the cart - an offer variant with a quantity. Items of `cart.items`. Available on: [cart page](../page-types.md#cart). ## Properties | Property | Type | Description | | --- | --- | --- | | `cart_line.id` | string | Line identifier - pass it as `line` to `/cart/change.js`. | | `cart_line.title` | string | Offer title. | | `cart_line.variantTitle` | string or null | Variant label, for example `L / Natural`. Null for an offer without options. | | `cart_line.url` | string | Address of the offer page. | | `cart_line.quantity` | number | Number of units. | | `cart_line.unitPrice` | number | Price of one unit including product options (engraving, gift wrap), in minor units. | | `cart_line.linePrice` | number | Unit price times quantity, before discounts, in minor units. | | `cart_line.lineDiscount` | number | Promotion discount on this line, in minor units. | | `cart_line.finalLinePrice` | number | Line value after discounts, in minor units. | | `cart_line.compareAtPrice` | number or null | Regular unit price when it is higher than the price in the cart - for a crossed-out price. | | `cart_line.variantId` | string | Identifier of the offer variant - the `id` accepted by `/cart/add.js`. | | `cart_line.product` | [`product`](product.md) | The offer of this line. | | `cart_line.options` | list | Product options the customer chose, as a list of `{ label, value, price }`. | | `cart_line.available` | boolean | False when the variant can no longer be bought. | | `cart_line.problem` | string or null | Message when the line cannot be bought in this quantity (out of stock). Only on the cart page. | | `cart_line.image` | [`media`](media.md) or null | The first picture of the offer. | --- # category Source: https://shopdepot.dev/docs/reference/objects/category/ <!-- Generated by `bin/console app:dev:reference` from the platform code and docs/dev/_data/. Do not edit by hand. --> A store category. Each store has its own category tree. Available on: [category page](../page-types.md#category), [home page](../page-types.md#index), settings that point at it. ## Properties | Property | Type | Description | | --- | --- | --- | | `category.id` | string | Category identifier. | | `category.title` | string | Category name. | | `category.handle` | string | The URL handle - `/categories/<handle>/`. | | `category.url` | string | Address of the category page. | | `category.childrenUrl` | string | JSON with the subcategories (`/categories/<handle>/children.json`) - load deeper menu levels on demand. | | `category.icon` | [`file`](file.md) or null | The category icon set in the admin (a `file`, image or SVG), null without one. Decorative - render it with an empty `alt`. An SVG (`icon.vector`) can be drawn as a CSS mask so it takes the text colour. | | `category.image` | [`file`](file.md) or null | The category image set in the admin (a `file`), null without one - a banner on the category page or a tile in a grid of categories. Its `alt` is the category name unless the file has its own. It is above the fold on the category page, so render it with `loading: 'eager'` and `fetchpriority: 'high'`. | | `category.heading` | string | The H1 heading for the category page - set in the admin, the category name when left empty. Use it for the page heading and `title` everywhere else (menus, tiles, breadcrumbs). | | `category.description` | string or null | Category description, sanitised HTML. | | `category.additionalDescription` | string or null | A second description from the admin, sanitised HTML (empty without one) - usually shown below the products: a buying guide, FAQ or SEO text. | | `category.seoTitle` | string or null | SEO title from the category. | | `category.seoDescription` | string or null | Meta description from the category. | | `category.depth` | number | 0 for a top-level category. | | `category.parent` | [`category`](category.md) or null | The parent category, null for a top-level one. | | `category.ancestors` | list of [`category`](category.md) | The path from the top-level category, for breadcrumbs. | | `category.pathLabel` | string | The category path as text, for example `Home › Beauty › Face`. | | `category.children` | list of [`category`](category.md) | Subcategories with their offer counts. Only on a category page. | | `category.siblings` | list of [`category`](category.md) | Categories with the same parent, this one included. Only on a category page. | | `category.filters` | hash | Listing filters of the page: `active` (chosen dictionary values, each with the URL that removes it), `price_min` and `price_max` (form values), `price_url` (the URL without the price), `selected` (feature slug to handles), `sort` (empty means the store default), `clear_url`, `any` (any filter is on) and `page_url` (with `%d` for the page number). | | `category.products` | list of [`product`](product.md) | The offers of the current listing page. | | `category.productsCount` | number | Number of offers in the whole listing. | ## Methods | Method | Returns | Description | | --- | --- | --- | | `category.facet(slug)` | list | Options of a dictionary filter among the listing's offers, by the address of the feature page - `category.facet('brands')`. A list of `{ title, handle, count }`. | --- # feature Source: https://shopdepot.dev/docs/reference/objects/feature/ <!-- Generated by `bin/console app:dev:reference` from the platform code and docs/dev/_data/. Do not edit by hand. --> The index page of a dictionary feature (`templates/terms.json`) - all authors, all brands and so on. Available on: [feature index](../page-types.md#terms), [feature value page](../page-types.md#term). ## Properties | Property | Type | Description | | --- | --- | --- | | `feature.id` | string | Feature page identifier. | | `feature.type` | string | The feature code, for example `authors` - branch on it in a template. | | `feature.title` | string | The page heading, for example `Authors`. | | `feature.label` | string | The feature name in singular, as in the product specification. | | `feature.description` | string | Introduction text. | | `feature.seoTitle` | string or null | SEO title. | | `feature.seoDescription` | string or null | Meta description. | | `feature.url` | string | Address of the index page. | | `feature.layout` | string | The layout chosen by the merchant - `auto` (the theme decides), `portraits` or `logos`. | | `feature.showAlphabet` | boolean | Show the alphabet filter. | | `feature.showSearch` | boolean | Show the search field. | | `feature.showCount` | boolean | Show the number of values next to the heading. | | `feature.sort` | string | Order of values - `name` or `offers`. | | `feature.terms` | list of [`term`](term.md) | The values on the current page. | | `feature.termsCount` | number | Number of values matching the current search and letter. | | `feature.query` | string | The search phrase (`?q=`). | | `feature.letter` | string | The chosen letter (`A`, `#`), empty for all. | | `feature.letters` | list | The alphabet filter - each entry has a label, a URL and an `active` flag. | | `feature.currentPage` | number | The current page number. | | `feature.pagesCount` | number | Number of pages. | | `feature.pagination` | list | Page links with gaps - a list of `{ label, url, current }`. | | `feature.previousUrl` | string or null | Address of the previous page. | | `feature.nextUrl` | string or null | Address of the next page. | | `feature.robots` | string | Robots directive of the index page. The platform writes the meta tag - read it only to branch. | | `feature.termRobots` | string | Robots directive of the value pages. | ## Methods | Method | Returns | Description | | --- | --- | --- | | `feature.urlForPage(number)` | string | Address of page `n` with the current letter and search. | --- # file Source: https://shopdepot.dev/docs/reference/objects/file/ <!-- Generated by `bin/console app:dev:reference` from the platform code and docs/dev/_data/. Do not edit by hand. --> A file from the store's media library - what an `image_picker`, `file_picker` or `video` setting returns. Available on: settings that point at it. ## Properties | Property | Type | Description | | --- | --- | --- | | `file.id` | string | File identifier. | | `file.mediaType` | string | `image`, `video`, `document` and so on. | | `file.vector` | boolean | True for an SVG. SVG files are cleaned on upload (no scripts or external references) and have no renditions. | | `file.alt` | string | Alternative text. | | `file.name` | string | Original file name. | | `file.sizeLabel` | string | Human readable size, for example `1.2 MB`. | | `file.width` | number or null | Width in pixels for images and videos. | | `file.height` | number or null | Height in pixels for images and videos. | | `file.url` | string | Address of the original file. | | `file.posterUrl` | string or null | Poster frame of a video. | ## Methods | Method | Returns | Description | | --- | --- | --- | | `file.urlForWidth(width)` | string | The rendition closest to a width - used by `\|image_url(width: …)`. Prefer the filter. | --- # link Source: https://shopdepot.dev/docs/reference/objects/link/ <!-- Generated by `bin/console app:dev:reference` from the platform code and docs/dev/_data/. Do not edit by hand. --> One link of a menu, with its submenu and an optional mega-menu panel. Available on: settings that point at it. ## Properties | Property | Type | Description | | --- | --- | --- | | `link.title` | string | Link text. | | `link.url` | string | Link address. | | `link.type` | string | What the link points at - `home`, `page`, `post`, `blog`, `product`, `category` or `url`. | | `link.newTab` | boolean | True when the merchant wants the link to open in a new tab. | | `link.active` | boolean | True when the link is the current page. | | `link.childActive` | boolean | True when the link or anything below it is the current page - highlight the top-level item. | | `link.links` | list of [`link`](link.md) | The next level of the menu. | | `link.levels` | number | How many link levels the panel holds - 1 is a plain dropdown, 2 or more are columns. | | `link.hasPanel` | boolean | True when the link opens a panel on hover. | | `link.panel` | string | Panel mode - `links`, `html_links` or `html`. | | `link.panelHtml` | string | The merchant's own HTML for the panel, sanitised. | | `link.featured` | [`product`](product.md) or null | An offer the merchant pinned to the panel. | | `link.category` | [`category`](category.md) or null | The category of a category link. | | `link.hasChildren` | boolean | True when there are subcategories, loaded or still to load. | | `link.childrenUrl` | string or null | JSON with the next level (see the menu API). | --- # media Source: https://shopdepot.dev/docs/reference/objects/media/ <!-- Generated by `bin/console app:dev:reference` from the platform code and docs/dev/_data/. Do not edit by hand. --> A picture or video from an offer gallery. Pass it to `|image_url`. Available on: [offer page](../page-types.md#product). ## Properties | Property | Type | Description | | --- | --- | --- | | `media.id` | string | Media identifier. | | `media.mediaType` | string | `image` or `video`. | | `media.alt` | string | Alternative text. | | `media.width` | number or null | Width of the original in pixels. | | `media.height` | number or null | Height of the original in pixels. | | `media.url` | string | Address of the original file. | | `media.posterUrl` | string or null | Poster frame of a video. | ## Methods | Method | Returns | Description | | --- | --- | --- | | `media.urlForWidth(width)` | string | The rendition closest to a width - used by `\|image_url(width: …)`. Prefer the filter. | --- # menu Source: https://shopdepot.dev/docs/reference/objects/menu/ <!-- Generated by `bin/console app:dev:reference` from the platform code and docs/dev/_data/. Do not edit by hand. --> A store menu - what a `link_list` setting returns. Available on: settings that point at it. ## Properties | Property | Type | Description | | --- | --- | --- | | `menu.title` | string | Menu name. | | `menu.handle` | string | Menu handle, for example `main-menu`. | | `menu.links` | list of [`link`](link.md) | Top-level links. | --- # page Source: https://shopdepot.dev/docs/reference/objects/page/ <!-- Generated by `bin/console app:dev:reference` from the platform code and docs/dev/_data/. Do not edit by hand. --> A content page of the store (About us, Shipping and so on). Available on: [content page](../page-types.md#page), [search](../page-types.md#search). ## Properties | Property | Type | Description | | --- | --- | --- | | `page.id` | string | Page identifier. | | `page.title` | string | Page title. | | `page.handle` | string | The page path, for example `company/about-us`. | | `page.url` | string | Address of the page. | | `page.content` | string | Page content, ready HTML - print it with `\|raw`. | | `page.summary` | string | A short text version of the content. | | `page.seoTitle` | string or null | SEO title from the page. | | `page.seoDescription` | string or null | Meta description from the page. | --- # product Source: https://shopdepot.dev/docs/reference/objects/product/ <!-- Generated by `bin/console app:dev:reference` from the platform code and docs/dev/_data/. Do not edit by hand. --> An offer - what a customer buys in this store. Called `product` in templates so themes written for Shopify read naturally. One offer can have variants (options such as size) and a variant can be a bundle of several products. Available on: [offer page](../page-types.md#product), [home page](../page-types.md#index), [category page](../page-types.md#category), [feature value page](../page-types.md#term), [search](../page-types.md#search), settings that point at it. ## Properties | Property | Type | Description | | --- | --- | --- | | `product.id` | string | Offer identifier. | | `product.title` | string | Offer title. | | `product.handle` | string | The URL handle - `/products/<handle>/`. | | `product.url` | string | Address of the offer page. | | `product.description` | string | Long description, sanitised HTML - print it with `\|raw`. | | `product.shortDescription` | string | Short description, sanitised HTML. | | `product.seoTitle` | string or null | The SEO title from the offer, empty when the merchant did not set one. The platform writes `<title>` itself. | | `product.seoDescription` | string or null | The meta description from the offer. | | `product.createdAt` | date | When the offer was created in this store - for a "New" badge. | | `product.available` | boolean | True when at least one variant can be bought. | | `product.bundle` | boolean | True when the offer is a bundle of several products. | | `product.type` | string | What the merchant declared the offer is - `single`, `variants` or `bundle`. | | `product.price` | number | Gross price of the variant the page shows, in minor units. Format with `\|money`. | | `product.priceFrom` | number or null | Lowest variant price, in minor units. | | `product.priceTo` | number or null | Highest variant price, in minor units. | | `product.priceVaries` | boolean | True when variants have different prices - show "from". | | `product.compareAtPrice` | number or null | Regular price when a sale is running, for a crossed-out price. Null otherwise. | | `product.selectedOrFirstAvailableVariant` | [`variant`](variant.md) or null | The variant chosen with `?variant=` or the first one that can be bought. | | `product.variants` | list of [`variant`](variant.md) | Variants a customer can buy. | | `product.options` | list | Option axes for a variant picker: a list of `{ name, values }`, for example `{ name: "Size", values: ["S", "M"] }`. | | `product.hasOptions` | boolean | True when the offer has option axes. | | `product.media` | list of [`media`](media.md) | Pictures and videos of the offer's products, in the order the merchant set. | | `product.galleryLayout` | string | Gallery layout chosen on the offer - `auto`, `thumbs` or `mosaic`. | | `product.featuredMedia` | [`media`](media.md) or null | The first picture. | | `product.features` | hash | The specification: feature name to displayed value, in the order set by the category. | | `product.featuresByCode` | hash | Feature values keyed by feature code and by lowercase name, in the same form as `features`. | | `product.fieldValues` | hash | Full feature values keyed by code - for themes that build content blocks from features. | | `product.brand` | string or null | Brand of the first product of the offer. | | `product.sku` | string or null | SKU of the first variant. | | `product.categories` | list of [`category`](category.md) | Store categories the offer is in, the main category first. | | `product.mainCategory` | [`category`](category.md) or null | The main category of the offer (marked with a star in the admin) - use it for breadcrumbs. | | `product.rating` | number or null | Average review rating from 1 to 5, weighted across the offer's products. Null when there are no reviews. | | `product.ratingCount` | number | Number of published reviews. | | `product.reviews` | [`reviews`](reviews.md) or null | Reviews to show. Only on the offer page; null elsewhere. | | `product.preorder` | boolean | True when the variant the page shows (or the first one) is sold in pre-order - it can be bought and ships later. Use it for a "Pre-order" badge. | | `product.preorderDate` | date or null | Expected shipping date of that pre-order. Null when there is no date. Format it with the `date` filter. | | `product.optionFields` | list | Product option fields (engraving, gift wrap) for the add-to-cart form - each with a ready `name` attribute (`properties[<id>]`) and prices in minor units. Empty outside the offer page. | --- # review Source: https://shopdepot.dev/docs/reference/objects/review/ <!-- Generated by `bin/console app:dev:reference` from the platform code and docs/dev/_data/. Do not edit by hand. --> One published review. The reviewer's e-mail and order are never exposed to a theme. Available on: [offer page](../page-types.md#product), settings that point at it. ## Properties | Property | Type | Description | | --- | --- | --- | | `review.id` | string | Review identifier. | | `review.rating` | number | Rating from 1 to 5. | | `review.title` | string or null | Review title. | | `review.body` | string or null | Review text. | | `review.author` | string | The name the reviewer gave. Empty - show "Customer". | | `review.verified` | boolean | True when the review comes from a confirmed order. | | `review.createdAt` | date | When the review was written. | | `review.variant` | string or null | The version the reviewer bought, when it is known. | | `review.reply` | string or null | The store's reply. | | `review.repliedAt` | date or null | When the store replied. | | `review.answers` | list | Answers to the merchant's questions as a list of `{ label, value }`. | --- # reviews Source: https://shopdepot.dev/docs/reference/objects/reviews/ <!-- Generated by `bin/console app:dev:reference` from the platform code and docs/dev/_data/. Do not edit by hand. --> Reviews of an offer, from every channel the products are sold in. Only on the offer page, as `product.reviews`. Available on: [offer page](../page-types.md#product). ## Properties | Property | Type | Description | | --- | --- | --- | | `reviews.count` | number | Number of published reviews. | | `reviews.average` | number or null | Average rating from 1 to 5. | | `reviews.distribution` | list | Ratings from 5 to 1 with a percentage for the bar - a list of `{ rating, count, percent }`. | | `reviews.items` | list of [`review`](review.md) | The latest published reviews. | | `reviews.highlights` | list | Summaries of the merchant's review questions, for example "taste - sweet 83%". | --- # section Source: https://shopdepot.dev/docs/reference/objects/section/ <!-- Generated by `bin/console app:dev:reference` from the platform code and docs/dev/_data/. Do not edit by hand. --> The section being rendered. Available inside every section file. Available on: every section file. ## Properties | Property | Type | Description | | --- | --- | --- | | `section.id` | string | The section key from the JSON template. | | `section.type` | string | The section type (the file name). | | `section.settings` | hash | Values of the section settings, resolved - a `product` setting gives a product object, not an id. | | `section.blocks` | list of [`block`](block.md) | The blocks of the section. | | `section.index` | number | Position of the section on the page, counted from 0. | | `section.attributes` | html | Attributes the theme editor needs to select the section in the preview. Print them on the root element. | --- # shop Source: https://shopdepot.dev/docs/reference/objects/shop/ <!-- Generated by `bin/console app:dev:reference` from the platform code and docs/dev/_data/. Do not edit by hand. --> The store the page belongs to. Available everywhere as the global `shop`. Available on: every page (global). ## Properties | Property | Type | Description | | --- | --- | --- | | `shop.name` | string | The store name, as set in the store settings. | | `shop.domain` | string | The host the page was requested on - the custom domain when it is set, otherwise `<handle>.myshopdepot.pl`. | | `shop.url` | string | The store address with `https://`, no trailing slash. | | `shop.currency` | string | ISO 4217 code of the store currency, for example `PLN`. | | `shop.locale` | string | Language of the store, for example `pl` or `en`. Use it for `<html lang>`. | | `shop.timezone` | string | IANA time zone of the store, for example `Europe/Warsaw`. | --- # term Source: https://shopdepot.dev/docs/reference/objects/term/ <!-- Generated by `bin/console app:dev:reference` from the platform code and docs/dev/_data/. Do not edit by hand. --> One value of a dictionary feature - an author, a publisher, an ingredient - with its page in the store (`templates/term.json`). Available on: [feature value page](../page-types.md#term), [feature index](../page-types.md#terms). ## Properties | Property | Type | Description | | --- | --- | --- | | `term.id` | string | Value identifier. | | `term.title` | string | Value name. | | `term.handle` | string | The URL handle. | | `term.url` | string | Address of the value page. | | `term.image` | [`file`](file.md) or null | The picture set for this value in this store. | | `term.description` | string | Description set for this value in this store, sanitised HTML. | | `term.seoTitle` | string or null | SEO title for this value in this store. | | `term.seoDescription` | string or null | Meta description for this value in this store. | | `term.feature` | [`feature`](feature.md) | The feature page this value belongs to. | | `term.products` | list of [`product`](product.md) | The offers of the current listing page. | | `term.productsCount` | number | Number of offers with this value. | | `term.filters` | hash | Listing filters - the same keys as `category.filters`. | ## Methods | Method | Returns | Description | | --- | --- | --- | | `term.facet(slug)` | list | Options of a dictionary filter among this value's offers - `term.facet('publishers')`. | --- # variant Source: https://shopdepot.dev/docs/reference/objects/variant/ <!-- Generated by `bin/console app:dev:reference` from the platform code and docs/dev/_data/. Do not edit by hand. --> One buyable combination of the offer's options. A variant can be one product, a multipack or a bundle. Available on: [offer page](../page-types.md#product). ## Properties | Property | Type | Description | | --- | --- | --- | | `variant.id` | string | Variant identifier - the `id` for `/cart/add.js`, and `?variant=` on the offer page. | | `variant.title` | string | Variant name. | | `variant.description` | string | The merchant's note about this version - plain text, empty when there is none. | | `variant.featuredMedia` | [`media`](media.md) or null | The picture of this variant, null when the variant has none. | | `variant.optionsLabel` | string or null | The options label, for example `L / Natural`. Empty for an offer without options. | | `variant.optionValues` | hash | Option name to chosen value. | | `variant.sku` | string or null | Variant SKU. | | `variant.price` | number | Gross price, in minor units. | | `variant.compareAtPrice` | number or null | Regular price, shown only while a sale is running. | | `variant.lowestPrice30d` | number or null | The lowest price of the 30 days before the current sale (Omnibus Directive). Show it next to a sale price. | | `variant.available` | boolean | True when the variant can be bought. | | `variant.bundle` | boolean | True when the variant is made of several products. | | `variant.stockStatus` | string | `instock`, `outofstock`, `onbackorder` or `onpreorder`. A bundle takes the weakest status of its products. | | `variant.preorder` | boolean | True when the variant is sold in pre-order. It can still be bought - `available` stays true. | | `variant.preorderDate` | date or null | Expected shipping date of the pre-order - the latest date of the bundle's products. Null when there is no date. | --- # widget Source: https://shopdepot.dev/docs/reference/objects/widget/ <!-- Generated by `bin/console app:dev:reference` from the platform code and docs/dev/_data/. Do not edit by hand. --> A named, configured instance of a section type - what a `widget` setting returns. Render it with `render_widget()`. Available on: settings that point at it. ## Properties | Property | Type | Description | | --- | --- | --- | | `widget.id` | string | Widget identifier. | | `widget.handle` | string | Widget handle. | | `widget.name` | string | Widget name shown to the merchant. | | `widget.type` | string | The section type the widget is an instance of. |