Twig Modification Fix For Opencart and

(Last Updated On: November 1, 2020)

If you are using Opencart version and you must have come across an issue related to the Extension Modification system. The twig files won’t apply and you may see abnormal errors after extension installation.

This issue happens when you click the refresh icon on the Extension Modification page. And you will see no changes done for the extension. In fact some abnormal things might happen.

So in order to fix the issue related to that you must change one single file and it would fix your issue.

Twig Modification Fix For Opencart and

So what is the fix?

  1. You must log in to your server via cPanel or Filezilla.
  2. And then go to the System folder.
  3. Open modification.xml file.
  4. Replace all the code with the content below.
  5. So the full path will be System – Modification.xml
<?xml version="1.0" encoding="utf-8"?>
  <name>Modification Default</name>
  <author>OpenCart Ltd</author>
  <file path="system/{engine,library}/{action,loader,config,language}*.php|system/library/template/template.php">
      <search regex="true">
      <add position="replace">
  <file path="system/library/template/twig.php">
        <![CDATA[if (is_file($file)) {]]>
      <add position="replace">
        <![CDATA[if (defined('DIR_CATALOG') && is_file(DIR_MODIFICATION . 'admin/view/template/' . $filename . '.twig')) {	
                $code = file_get_contents(DIR_MODIFICATION . 'admin/view/template/' . $filename . '.twig');
            } elseif (is_file(DIR_MODIFICATION . 'catalog/view/theme/' . $filename . '.twig')) {
                $code = file_get_contents(DIR_MODIFICATION . 'catalog/view/theme/' . $filename . '.twig');
            } elseif (is_file($file)) {]]>

Once the above code is added. Save the file. And go to Admin – Extension – Modification and click refresh icon.

Issue Resolved.

Leave a Reply

Your email address will not be published. Required fields are marked *