Currency change with language TranslatePress
-
Hello All,
I am using TranslatePress on this website https://nedanacheva.com/, wich WOOCS plugin and PHP script in functions.php for automatic change of currency with language change, English->EUR, Bulgarian-> BGN.
$lang=get_locale(); global $WOOCS; switch($lang){ case 'bg_BG': $WOOCS->current_currency='BGN'; $WOOCS->storage->set_val('woocs_current_currency', 'BGN'); break; case 'en_GB': $WOOCS->current_currency='EUR'; $WOOCS->storage->set_val('woocs_current_currency', 'EUR'); break; default: $WOOCS->current_currency='EUR'; $WOOCS->storage->set_val('woocs_current_currency', 'EUR'); break; }
It works, but i think this script is a little outdated because i have issue with Elementor because of it, and in error_log i have this errors:
[01-Oct-2020 17:16:49 UTC] PHP Warning: Creating default object from empty value in /home/nedanach/public_html/wp-content/themes/bridge-child/functions.php on line 17 [01-Oct-2020 17:16:49 UTC] PHP Fatal error: Uncaught Error: Call to a member function set_val() on null in /home/nedanach/public_html/wp-content/themes/bridge-child/functions.php:18
which are exactly the lines for automatic currency switch with language.
Also because of those lines, i cannot get Elementor to work, when this code is active, Elementor cannot load edit mode.
Please help me what must be change to code to continue work and Elemntor to work without errors.
The page I need help with: [log in to see the link]
- The topic ‘Currency change with language TranslatePress’ is closed to new replies.