Disable template caching for development in OpenCart 3

Another way to do this: Open to system\library\template\Twig\Cache\Filesystem.php, find following lines of code

public function load($key)
{
    if (file_exists($key)) {
        @include_once $key;
    }
}

Comment out as in the following code:

public function load($key)
{
    // if (file_exists($key)) {
    //      @include_once $key;
    // }
}

This will remove the template cache of the twig and recreate every time, once development is over you have to remove the comment.


You might need to upgrade to a more recent version of OpenCart3 - the first one (3.0.0.0) didn't have a way of doing this in the GUI.

More recent versions, such as 3.0.2.0, have a gear on the admin dashboard. Click the gear and you get options to disable caching.

enter image description here