Nunjucks Theme API
Version:1.0.0 (MARKT_NUNJUCKS_API_VERSION)
Framework-agnostic Nunjucks engine for MARKT storefronts. Themes use standard Nunjucks (extends, include, macro, for, if) plus the stable context below.
For product grids and tags, also read Shortcodes & Tags and Build a Custom Theme.
Before shipping a live Nunjucks theme, read Nunjucks Theme Pitfalls (autoescape, Alpine x-data, cartPage, lean cart API, visibility).
Legal pages: Policy & Legal Pages — store.policies.* and files privacy-policy.njk / terms.njk / refund-policy.njk.
Architecture
Lifecycle
Context objects (stable v1)
Types:
lib/builder/nunjucks/api/types.ts
MarktProduct (summary)
Typical fields: id, slug, name, description, image, minPrice / maxPrice (not a top-level price), visibility, stock (-1 = unlimited), variants, groupId.
Product groups
- Prefer
catalogItems/standaloneProductsfor homepage grids — never list everyproductsentry as a card when groups exist. - Group members:
helpers.components.products.getItemsByIds(products, group.productIds).
On-hold (visibility)
Filters
Tags
Globals
Minimal theme layout
Cart
MarktCartItem shape (camelCase):
components/cart-page.njk get markt-cart-client injected for quantity/remove/checkout sync.
settings.json
templates/*.njk.
Extensions (optional)
markt.sellauth activates for legacy {% render_component %}, {% render_snippet %}, apiInternalUrl, or schema.json. Native themes use Join Markt tag names only.
Stability
- Minor/patch: additive fields/filters/extensions
- Major: removing/renaming core context keys, filters, or globals