Fatal Error using currency
-
Hi,
I was trying to add a second currency on my website and it just crashed, giving me the following error:
Fatal error: Uncaught TypeError: Return value of WCPay\MultiCurrency\Currency::get_name() must be of the type string, null returned in /home/customer/www/legoudalier.com/public_html/wp-content/plugins/woocommerce-payments/includes/multi-currency/Currency.php:156 Stack trace: #0 /home/customer/www/legoudalier.com/public_html/wp-content/plugins/woocommerce-payments/includes/multi-currency/Analytics.php(135): WCPay\MultiCurrency\Currency->get_name() #1 /home/customer/www/legoudalier.com/public_html/wp-content/plugins/woocommerce-payments/includes/multi-currency/Analytics.php(64): WCPay\MultiCurrency\Analytics->register_customer_currencies() #2 /home/customer/www/legoudalier.com/public_html/wp-content/plugins/woocommerce-payments/includes/multi-currency/Analytics.php(53): WCPay\MultiCurrency\Analytics->init() #3 /home/customer/www/legoudalier.com/public_html/wp-content/plugins/woocommerce-payments/includes/multi-currency/MultiCurrency.php(260): WCPay\MultiCurrency\Analytics->__construct(Object(WCPay\MultiCurrency\MultiCurrenc in /home/customer/www/legoudalier.com/public_html/wp-content/plugins/woocommerce-payments/includes/multi-currency/Currency.php on line 156
I tried rolling back the plugin to no avail. How can I fix this, please? My website is down. Thank you.
-
Line 154 to 156 says this:
public function get_name(): string {
$wc_currencies = get_woocommerce_currencies();
return $wc_currencies[ $this->code ];
}
Hi @mtlullaby
Thanks for reaching out!
I am sorry to hear that you received the error message above when trying to add another currency on your site when using the WooCommerce Payments plugin.
As a first step, please make sure that you are using the latest version of the plugin which was released one week ago. You can check it under Plugins > Installed Plugins > WooCommerce Payments.
If yes, I trust that you’ve followed the instructions on this support documentation when trying to set up multi-currency on your site: WooCommerce Payments: Currencies
Otherwise, for us to investigate your issue further, I’d like to understand your site properly. Please share your System Status Report that you can find via
WooCommerce > Status. SelectGet system reportand thenCopy for support. Once you’ve done that, you can paste it into your reply here.You could copy and paste your reply here or paste it via https://gist.github.com/ and send the link here.
Thanks!
Hi @xue28,
Thanks for your response. To answer your questions, yes I had the latest version of the plugin (updated the day before my problem) and followed the instructions correctly. I have, however, since deactivated the Woocommerce Payments plugin as my site wasn’t working so I am currently using the PeachPay plugin which seems to be working fine.
Here is my status report:
WordPress Environment WordPress address (URL): https://legoudalier.com Site address (URL): https://legoudalier.com WC Version: 7.7.0 REST API Version: ✔ 7.7.0 WC Blocks Version: ✔ 10.0.4 Action Scheduler Version: ✔ 3.5.4 Log Directory Writable: ✔ WP Version: 6.2 WP Multisite: – WP Memory Limit: 768 MB WP Debug Mode: – WP Cron: ✔ Language: en_US External object cache: ✔ Server Environment Server Info: Apache PHP Version: 7.4.33 PHP Post Max Size: 256 MB PHP Time Limit: 600 PHP Max Input Vars: 3000 cURL Version: 7.85.0 OpenSSL/3.0.8 SUHOSIN Installed: – MySQL Version: 5.7.39-42-log Max Upload Size: 2 GB Default Timezone is UTC: ✔ fsockopen/cURL: ✔ SoapClient: ✔ DOMDocument: ✔ GZip: ✔ Multibyte String: ✔ Remote Post: ✔ Remote Get: ✔ Database WC Database Version: 7.7.0 WC Database Prefix: wprv_ Total Database Size: 149.13MB Database Data Size: 101.09MB Database Index Size: 48.04MB wprv_woocommerce_sessions: Data: 4.02MB + Index: 1.03MB + Engine InnoDB wprv_woocommerce_api_keys: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wprv_woocommerce_attribute_taxonomies: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wprv_woocommerce_downloadable_product_permissions: Data: 0.02MB + Index: 0.06MB + Engine InnoDB wprv_woocommerce_order_items: Data: 1.52MB + Index: 0.28MB + Engine InnoDB wprv_woocommerce_order_itemmeta: Data: 7.52MB + Index: 8.03MB + Engine InnoDB wprv_woocommerce_tax_rates: Data: 0.02MB + Index: 0.06MB + Engine InnoDB wprv_woocommerce_tax_rate_locations: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wprv_woocommerce_shipping_zones: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wprv_woocommerce_shipping_zone_locations: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wprv_woocommerce_shipping_zone_methods: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wprv_woocommerce_payment_tokens: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wprv_woocommerce_payment_tokenmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wprv_woocommerce_log: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wprv_actionscheduler_actions: Data: 13.02MB + Index: 10.11MB + Engine InnoDB wprv_actionscheduler_claims: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wprv_actionscheduler_groups: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wprv_actionscheduler_logs: Data: 6.02MB + Index: 5.03MB + Engine InnoDB wprv_cartflows_ca_cart_abandonment: Data: 0.27MB + Index: 0.02MB + Engine InnoDB wprv_cartflows_ca_email_history: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wprv_cartflows_ca_email_templates: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wprv_cartflows_ca_email_templates_meta: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wprv_commentmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wprv_comments: Data: 2.52MB + Index: 1.08MB + Engine InnoDB wprv_commercekit_searches: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wprv_commercekit_swatches_cache_count: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wprv_commercekit_waitlist: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wprv_commercekit_wishlist: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wprv_commercekit_wishlist_items: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wprv_e_events: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wprv_e_notes: Data: 0.02MB + Index: 0.17MB + Engine InnoDB wprv_e_notes_users_relations: Data: 0.02MB + Index: 0.05MB + Engine InnoDB wprv_e_submissions: Data: 0.02MB + Index: 0.27MB + Engine InnoDB wprv_e_submissions_actions_log: Data: 0.02MB + Index: 0.11MB + Engine InnoDB wprv_e_submissions_values: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wprv_links: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wprv_options: Data: 9.09MB + Index: 2.08MB + Engine InnoDB wprv_peachpay_analytics_interval: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wprv_peachpay_analytics_meta: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wprv_peachpay_customer_cart: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wprv_peachpay_customer_cart_contents: Data: 0.08MB + Index: 0.08MB + Engine InnoDB wprv_peachpay_customer_cart_meta: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wprv_pimwick_gift_card: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wprv_pimwick_gift_card_activity: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wprv_postmeta: Data: 32.47MB + Index: 10.80MB + Engine InnoDB wprv_posts: Data: 12.45MB + Index: 0.72MB + Engine InnoDB wprv_say_what_strings: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wprv_smush_dir_images: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wprv_termmeta: Data: 0.27MB + Index: 0.31MB + Engine InnoDB wprv_terms: Data: 0.09MB + Index: 0.09MB + Engine InnoDB wprv_term_relationships: Data: 0.16MB + Index: 0.09MB + Engine InnoDB wprv_term_taxonomy: Data: 0.11MB + Index: 0.16MB + Engine InnoDB wprv_usermeta: Data: 1.52MB + Index: 1.98MB + Engine InnoDB wprv_users: Data: 0.09MB + Index: 0.05MB + Engine InnoDB wprv_wcpdf_invoice_number: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wprv_wcpdf_packing_slip_number: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wprv_wc_admin_notes: Data: 0.08MB + Index: 0.00MB + Engine InnoDB wprv_wc_admin_note_actions: Data: 0.05MB + Index: 0.02MB + Engine InnoDB wprv_wc_category_lookup: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wprv_wc_customer_lookup: Data: 0.08MB + Index: 0.06MB + Engine InnoDB wprv_wc_download_log: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wprv_wc_order_coupon_lookup: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wprv_wc_order_product_lookup: Data: 1.52MB + Index: 1.25MB + Engine InnoDB wprv_wc_order_stats: Data: 0.36MB + Index: 0.25MB + Engine InnoDB wprv_wc_order_tax_lookup: Data: 0.08MB + Index: 0.06MB + Engine InnoDB wprv_wc_product_attributes_lookup: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wprv_wc_product_download_directories: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wprv_wc_product_meta_lookup: Data: 0.22MB + Index: 0.45MB + Engine InnoDB wprv_wc_rate_limits: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wprv_wc_reserved_stock: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wprv_wc_tax_rate_classes: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wprv_wc_webhooks: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wprv_wfpklist_template_data: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wprv_wpforms_tasks_meta: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wprv_wpmailsmtp_debug_events: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wprv_wpmailsmtp_tasks_meta: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wprv_wt_iew_action_history: Data: 1.52MB + Index: 0.00MB + Engine InnoDB wprv_wt_iew_mapping_template: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wprv_yith_ywpar_points_log: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wprv_yoast_indexable: Data: 4.50MB + Index: 2.22MB + Engine InnoDB wprv_yoast_indexable_hierarchy: Data: 0.22MB + Index: 0.28MB + Engine InnoDB wprv_yoast_migrations: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wprv_yoast_primary_term: Data: 0.08MB + Index: 0.06MB + Engine InnoDB wprv_yoast_seo_links: Data: 0.06MB + Index: 0.03MB + Engine InnoDB Post Type Counts acf-field: 1 acf-field-group: 1 attachment: 958 custom_css: 2 customize_changeset: 1 elementor_font: 1 elementor_icons: 1 elementor_library: 12 mc4wp-form: 1 nav_menu_item: 38 page: 13 popup: 2 popup_theme: 8 post: 34 product: 455 product_variation: 4 revision: 1057 shop_coupon: 40 shop_order: 1104 shop_order_refund: 442 wp_block: 1 wp_global_styles: 1 wpforms: 2 Security Secure connection (HTTPS): ✔ Hide errors from visitors: ✔ Active Plugins (34) Advanced Custom Fields: by WP Engine – 6.1.6 Autoptimize: by Frank Goossens (futtta) – 3.1.7 Blogger Importer: by wordpressdotorg – 0.9.2 CommerceGurus CommerceKit: by CommerceGurus – 2.2.2 Cookie Notice & Compliance for GDPR / CCPA: by Hu-manity.co – 2.4.8 Elementor Pro: by Elementor.com – 3.13.0 Elementor: by Elementor.com – 3.13.1 F4 Total Stock Value for WooCommerce: by FAKTOR VIER – 2.0.5 GTranslate: by Translate AI Multilingual Solutions – 3.0.3 Jetpack: by Automattic – 12.1 Kirki Customizer Framework: by David Vongries – 4.1.1 MC4WP: Mailchimp for WordPress: by ibericode – 4.9.4 One Click Demo Import: by OCDI – 3.1.2 PeachPay Checkout and Payments for WooCommerce: Stripe, PayPal, Square: by PeachPay Inc. – 1.92.0 (update to version 1.92.1 is available) Pinterest for WooCommerce: by WooCommerce – 1.2.21 PW WooCommerce Gift Cards Pro: by Pimwick LLC – 1.407 Say What?: by Ademti Software – 2.1.4 SiteGround Optimizer: by SiteGround – 7.3.1 Sucuri Security - Auditing, Malware Scanner and Hardening: by Sucuri Inc. – 1.8.39 Trustpilot-reviews: by Trustpilot – 2.5.914 WooCommerce Cart Abandonment Recovery: by CartFlows Inc – 1.2.24 WooCommerce Price Per Unit: by Martin Mechura – 1.9.3 Customizer for WooCommerce: by SkyVerge – 2.7.7 WooCommerce Stripe Gateway: by WooCommerce – 7.4.0 Booster for WooCommerce: by Pluggabl LLC – 6.0.5 WooCommerce: by Automattic – 7.7.0 WordPress Importer: by wordpressdotorg – 0.8.1 Yoast SEO: by Team Yoast – 20.7 WP Content Copy Protection & No Right Click: by wp-buy – 3.5.3 WP Mail SMTP: by WP Mail SMTP – 3.8.0 Wp Maximum Upload File Size: by CodePopular – 1.0.9 WP Rollback: by GiveWP.com – 1.7.3 WPForms Lite: by WPForms – 1.8.1.2 YITH WooCommerce Points and Rewards Premium: by YITH – 3.17.0 Inactive Plugins (3) CURCY - Multi Currency for WooCommerce: by VillaTheme – 2.1.30 FOX - Currency Switcher Professional for WooCommerce: by realmag777 – 1.4.0 WooCommerce Payments: by Automattic – 5.8.1 Dropin Plugins (2) advanced-cache.php: advanced-cache.php object-cache.php: Memcached Must Use Plugins (1) Elementor Safe Mode: by Elementor.com – 1.0.0 Settings API Enabled: – Force SSL: – Currency: EUR (€) Currency Position: left Thousand Separator: , Decimal Separator: . Number of Decimals: 2 Taxonomies: Product Types: external (external) grouped (grouped) pw-gift-card (pw-gift-card) simple (simple) subscription (subscription) variable (variable) variable subscription (variable-subscription) Taxonomies: Product Visibility: exclude-from-catalog (exclude-from-catalog) exclude-from-search (exclude-from-search) featured (featured) outofstock (outofstock) rated-1 (rated-1) rated-2 (rated-2) rated-3 (rated-3) rated-4 (rated-4) rated-5 (rated-5) Connected to WooCommerce.com: – Enforce Approved Product Download Directories: ✔ HPOS feature screen enabled: – HPOS feature enabled: – Order datastore: WC_Order_Data_Store_CPT HPOS data sync enabled: – WC Pages Shop base: #8 - /shop/ Cart: #9 - /cart/ Checkout: #10 - /checkout/ My account: #11 - /my-account/ Terms and conditions: #12 - /general-conditions-sale/ Theme Name: Shoptimizer Version: 2.6.5 Author URL: https://www.commercegurus.com/ Child Theme: ❌ – If you are modifying WooCommerce on a parent theme that you did not build personally we recommend using a child theme. See: How to create a child theme WooCommerce Support: ✔ Templates Overrides: – Admin Enabled Features: activity-panels analytics coupons customer-effort-score-tracks import-products-task experimental-fashion-sample-products shipping-smart-defaults shipping-setting-tour homescreen marketing mobile-app-banner navigation onboarding onboarding-tasks remote-inbox-notifications remote-free-extensions payment-gateway-suggestions shipping-label-banner subscriptions store-alerts transient-notices woo-mobile-welcome wc-pay-promotion wc-pay-welcome-page Disabled Features: product-block-editor minified-js new-product-management-experience product-variation-management settings Daily Cron: ✔ Next scheduled: 2023-05-14 16:50:14 +00:00 Options: ✔ Notes: 115 Onboarding: skipped Action Scheduler Canceled: 2 Oldest: 2023-04-20 20:42:47 +0000 Newest: 2023-04-22 15:10:46 +0000 Complete: 26,144 Oldest: 2023-04-12 21:22:00 +0000 Newest: 2023-05-13 21:13:48 +0000 Failed: 101 Oldest: 2022-11-07 22:57:15 +0000 Newest: 2023-05-10 18:12:05 +0000 Pending: 12 Oldest: 2023-05-13 21:23:48 +0000 Newest: 2023-05-18 17:21:16 +0000 Status report information Generated at: 2023-05-13 21:18:04 +00:00 `Thanks for your time.
Alan
-
This reply was modified 3 years ago by
mtlullaby.
Hi @mtlullaby
Thanks for providing further information about your issue here.
It looks like a third-party plugin or your theme might be causing the conflict here.
For us to investigate this further, can you please try to switch to the default Storefront theme and only WooCommerce and WooCommerce Payments plugins are enabled, repeat the steps in adding another currency and see if this works?
If so, then this kind of problem is usually caused by your theme or a third-party plugin present on your site. We can run a conflict test to verify this. I’d recommend cloning your site to a staging environment and performing the tests described on this guide without modifying your live site or impacting customers. Many hosts provide staging facilities, so it’s worth checking in with them. It’s also possible to do it using the free WP Staging plugin.
If this was caused by a third-party plugin present on your site, it would be best to reach out to the developers for further assistance here.
If this did not resolve the issue, please provide the fatal error logs (if any) under
WooCommerce > Status > Logs.You could copy and paste your reply here or paste it via https://gist.github.com/ and send the link here.
Let us know how it goes!
Thanks. I’ll give it a try, but the last time I had WC Payments activated it crashed my site. Trying it out on a staging site won’t make a difference and it will probably show that everything is OK as the Stripe gateway is not connected to the staging site.
Hi @mtlullaby
I understand that you have previously experienced issues with WC Payments causing your site to crash and are hesitant to try it again, even on a staging site. I apologize for the inconvenience this may have caused you, and I’m here to help you find a solution.
First, I would like to assure you that using a staging site is a safe way to test any changes or updates to your website. It allows you to identify and resolve potential issues before implementing them on your live site. While it’s true that the Stripe gateway won’t be connected to the staging site, you can still test the WC Payments plugin to ensure that it doesn’t cause any conflicts or crashes.
Please give the suggestions above a try and let us know how it goes!
Hi,
We haven’t heard back from you in a while, so I’m going to mark this as resolved – we’ll be here if and/or when you are ready to continue.
Best. -
This reply was modified 3 years ago by
The topic ‘Fatal Error using currency’ is closed to new replies.