Skip Navigation

Resolved

Resolved in: 4.7.3

Overview of the issue

With the version 4.7.0 of WooCommerce Multilingual you can get this error if you visit a product page or a page that contains a currency switcher.

PHP Fatal error: Uncaught LogicException: A function must be an instance of \Twig_FunctionInterface or \Twig_SimpleFunction. in .../public_html/wp-content/plugins/sitepress-multilingual-cms/lib/twig/src/Environment.php:1119
Stack trace:
#0 .../public_html/wp-content/plugins/woocommerce-multilingual/inc/template-classes/class-wcml-templates-factory.php(80): WPML\Core\Twig\Environment->addFunction(Object(__PHP_Incomplete_Class))
#1 .../public_html/wp-content/plugins/woocommerce-multilingual/inc/template-classes/class-wcml-templates-factory.php(24): WCML_Templates_Factory->maybe_init_twig()
#2 .../public_html/wp-content/plugins/woocommerce-multilingual/inc/currencies/currency-switcher/class-wcml-currency-switcher.php(143): WCML_Templates_Factory->get_view()
#3 .../public_html/wp-content/plugins/woocommerce-multilingual/inc/currencies/currency in /home/326328.cloudwaysapps.com/mufdqasvkk/public_html/wp-content/plugins/sitepress-multilingual-cms/lib/twig/src/Environment.php on line 1119
[21-Oct-2019 06:34:56 UTC] PHP Fatal error: Uncaught LogicException: A function must be an instance of \Twig_FunctionInterface or \Twig_SimpleFunction. in .../public_html/wp-content/plugins/sitepress-multilingual-cms/lib/twig/src/Environment.php:1119

This issue is caused by TWIG template support that we are on our way to phase-out and it will be fixed soon by our developers

Workaround

In order to fix this issue, just visit WooCommerce-> WCML -> Multicurrency tab in admin. The wrong option in the database is cleaned here, and you will not have a fatal error on product pages anymore.

One Response to “Visiting product page or a page where currency switcher is present, could produce an error with WooCommerce Multilingual v 4.7.0”