Theme Editor
Edit template files and create theme overrides using the built-in Theme Editor in OpenCart 4
Video Tutorial
Video: Using the Theme Editor in OpenCart 4
Introduction
The Theme Editor in OpenCart 4 provides a web‑based interface for editing template files directly from the admin panel. It supports the Twig templating language and lets you modify HTML structure, add custom code, and customize your store’s appearance without FTP access or direct file system modifications. All changes are stored in the database, allowing you to revert or disable them at any time.
Theme Override List

The Theme Override list shows all template overrides currently stored in the database. From here you can:
Add New: Create a new template override
Edit: Modify an existing override
Delete: Remove overrides you no longer need
Filter: Search overrides by store, route, or status
Each entry displays:
Store: Which store the override applies to (default or a specific store)
Route: The template file being overridden (e.g.,
common/header,product/product)Status: Whether the override is active (Enabled) or inactive (Disabled)
Date Added: When the override was created
Actions: Edit or delete buttons
Creating / Editing a Theme Override
When you create or edit a theme override, you fill out a form with the following fields:

Override Configuration
Store: Select which store this override applies to (default or a specific store in multi‑store setups).
Status: Enable or disable the override. Disabled overrides are ignored and the original template is used.
Choose Template: Select the template file you want to override. The list includes:
Default templates: All
.twigfiles fromcatalog/view/template/Extension templates: Templates provided by installed extensions (located in
extension/*/catalog/view/template/)
Code: The Twig template code that will replace the original template content for the selected route.
Code Editor Features 🔧 The editor includes syntax highlighting for Twig, HTML, CSS, and JavaScript, line numbers, and a monokai color scheme. It also supports automatic indentation and bracket matching.
How Theme Overrides Work
OpenCart 4 uses a template fallback system:
When a page is requested, OpenCart determines which template file should be rendered (e.g.,
catalog/view/template/product/product.twig).Before rendering, the system checks the
themedatabase table for an enabled override that matches the current store and route.If a matching override exists and its status is Enabled, the override’s
codeis used instead of the file content.If no override exists or the override is Disabled, the original template file is rendered.
This mechanism allows you to customize any template without touching the core files, making upgrades safer and reversible.
Template Structure Overview
OpenCart 4 organizes templates in a hierarchical structure:
Store Templates
catalog/view/template/
Frontend store templates
Admin Templates
admin/view/template/
Admin panel templates
Extension Templates
extension/*/view/template/
Extension‑specific templates
Theme Templates
catalog/view/theme/*/template/
Theme‑specific overrides
Twig Template Language Basics
OpenCart 4 uses Twig as its template engine. Below are the essential concepts you need to edit templates successfully.
Best Practices
Common Tasks
Editing an Existing Override
From the Theme Override list, click the Edit button next to the override you want to modify.
Adjust the Code as needed.
Toggle Status if you want to enable/disable the override.
Click Save.
Caution: Editing an active override will immediately change the live storefront. Consider disabling the override first if you want to test changes in isolation.
Warnings and Limitations
Critical Warnings
Database‑Only: Overrides are stored in the database. If you migrate your store, ensure the
themetable is included in the backup.No File Locking: Multiple administrators can edit the same template simultaneously; the last save wins. Coordinate with your team to avoid conflicts.
Extension Compatibility: Overriding extension templates may break when the extension is updated. Review extension changelogs before upgrading.
Twig Syntax Errors: A syntax error in your override can cause a white screen or broken layout. Always test with Debug Mode enabled.
Cache Interference: If template caching is enabled, changes may not appear immediately. Clear the template cache after saving overrides.
Troubleshooting
Last updated