Overview of the Issue
With the version 4.7.0 of WPML Multilingual & Multicurrency for WooCommerce 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): WPMLCoreTwigEnvironment->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
This issue is fixed. Updating to the latest version solves it on your site, so you only need this workaround if you can’t update yet.
In order to fix this issue, just visit WooCommerceWCMLMulticurrency tab in admin. The wrong option in the database is cleaned here, and you will not have a fatal error on product pages anymore.