Theme Structure
This section explains how the storefront Twig layer is organized in YuiCraftPlugin, and how developers should extend or override it safely in project code.
If you are building a custom storefront, this page is your entry point. Use it to understand:
- where the default templates are located,
- which layer owns which responsibility,
- how to override files without breaking plugin upgrade compatibility.
Storefront Layers
The plugin storefront is intentionally split into 4 layers:
yui/layouts/*: global page skeletons and top-level regionsyui/pages/*: route-level templates (catalog, cart, checkout, customer, pricing)yui/components/*: reusable feature units (cart summary, checkout sections, product details)yui/blocks/*: low-level partial fragments (totals rows, head includes, popup fragments)
Use this as a strict responsibility model. Keep each concern in its proper layer.
Source of Truth in Plugin
Default files are shipped under:
src/templates/frontend/
├── layouts/
│ ├── 1column.twig
│ ├── account.twig
│ ├── cart/
│ ├── catalog/
│ ├── checkout/
│ └── product/
├── pages/
│ ├── cart/
│ ├── catalog/
│ ├── checkout/
│ ├── customer/
│ └── pricing/
├── components/
│ ├── cart/
│ ├── catalog/
│ ├── checkout/
│ ├── customer/
│ ├── global/
│ ├── header/
│ └── product/
└── blocks/
├── _head/
├── cart/
├── checkout/
├── customer/
├── errors/
├── global/
└── ...
When in doubt, inspect this tree first before writing custom templates.
Rendering Flow
Typical request flow:
- A route resolves to a page template (
yui/pages/...). - The page extends a layout (
yui/layouts/...). - The page/layout compose one or more components.
- Components include blocks for repeated low-level rendering.
Override Strategy (Recommended Workflow)
To customize plugin templates, use path-compatible overrides in your project templates directory.
Rule:
- plugin path:
yui/... - project override path:
templates/yui/...
Example:
- plugin file:
yui/components/cart/no-items.twig - your override:
templates/yui/components/cart/no-items.twig
Practical workflow:
- Locate the original plugin file under
src/templates/frontend. - Copy only the file you need to override, keeping the same
yui/...relative path. - Make minimal, intentional changes.
- Keep comments for custom logic that differs from plugin defaults.
- Re-test cart/checkout/customer flows after each override.
What to Override First
For most projects, start in this order:
pagesfor route-level layout decisionscomponentsfor reusable feature behaviorblocksfor small repeated rendering fragmentslayoutsonly when global structure must change
Avoid overriding layouts/1column.twig early unless required, because it affects the full storefront.
Upgrade-Safe Guidelines
- Prefer small targeted overrides over replacing full layout trees.
- Keep plugin hooks and includes unless you intentionally replace them.
- Do not move project-specific business logic into global blocks.
- Document every override in your project changelog/README.
- Rebase your overrides against plugin updates regularly.