Fatal error while adding Product Bundle to cart in php 8
-
I have get fatal error while add some product to cart. The problem is that $dimension in the wc_get_dimension() function The datatype of the parameter is string. file path is wocommerce/includes/wc-formatting-functions.php file.
-
Hello @hirenbhanderi,
I understand you’re getting an error when adding something to the cart. Could you please share a copy of your site’s System Status Report as well as the error? You can find it via WooCommerce > Status. Select “Get system report” and then “Copy for support”.? Once you’ve done that, paste it here in your response.
Look forward to hearing back from you.
Hi @babylon1999
Sorry for late reply, are you required this type of data?
### WooCommerce Zapier ### Database Version: ? 12 Detailed Logging Enabled: No Legacy Mode Disabled: ? Yes REST API Authentication Key(s): ? 0 Task History Record Count: ? 0 ### Status report information ### Generated at: 2022-12-15 12:35:50 +00:00
Hello @hirenbhanderi,
Sorry for late reply, are you required this type of data?
Yes, but could you please attach the whole report and a screenshot of the error itself?
It’s also worth checking if there are any fatal error logs from WooCommerce > Status > Logs and choosing from the drop-down menu thefatal-errors.log
option.
Look forward to hearing back from you.2023-01-08T20:50:29+00:00 CRITICAL Uncaught TypeError: Unsupported operand types: string * float in /www/public/wp-content/plugins/woocommerce/includes/wc-formatting-functions.php:141 Stack trace: #0 /www/public/wp-content/plugins/woocommerce-shipping-usps/includes/class-wc-shipping-usps.php(1107): wc_get_dimension('', 'in') #1 /www/public/wp-content/plugins/woocommerce-shipping-usps/includes/class-wc-shipping-usps.php(949): WC_Shipping_USPS->weight_based_shipping(Array) #2 /www/public/wp-content/plugins/woocommerce-shipping-usps/includes/class-wc-shipping-usps.php(681): WC_Shipping_USPS->get_standard_package_requests(Array) #3 /www/public/wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-shipping-method.php(233): WC_Shipping_USPS->calculate_shipping(Array) #4 /www/public/wp-content/plugins/woocommerce/includes/class-wc-shipping.php(348): WC_Shipping_Method->get_rates_for_package(Array) #5 /www/public/wp-content/plugins/woocommerce/includes/class-wc-shipping.php(260): WC_Shipping->calculate_shipping_for_package(Array, 0) #6 /www/public/wp-content/plugins/woocommerce/includes/class-wc-cart.php(1423): WC_Shipping->calculate_shipping(Array) #7 /www/public/wp-content/plugins/woocommerce/includes/class-wc-cart-totals.php(339): WC_Cart->calculate_shipping() #8 /www/public/wp-content/plugins/woocommerce/includes/class-wc-cart-totals.php(850): WC_Cart_Totals->get_shipping_from_cart() #9 /www/public/wp-content/plugins/woocommerce/includes/class-wc-cart-totals.php(144): WC_Cart_Totals->calculate_shipping_totals() #10 /www/public/wp-content/plugins/woocommerce/includes/class-wc-cart-totals.php(134): WC_Cart_Totals->calculate() #11 /www/public/wp-content/plugins/woocommerce/includes/class-wc-cart.php(1401): WC_Cart_Totals->__construct(Object(WC_Cart)) #12 /www/public/wp-includes/class-wp-hook.php(306): WC_Cart->calculate_totals() #13 /www/public/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters(NULL, Array) #14 /www/public/wp-includes/plugin.php(517): WP_Hook->do_action(Array) #15 /www/public/wp-content/plugins/woocommerce/includes/class-wc-cart.php(1279): do_action('woocommerce_add...', 'a1ed1faa92e05bc...', 6130, 1, 6147, Array, Array) #16 /www/public/wp-content/plugins/woocommerce/includes/class-wc-form-handler.php(918): WC_Cart->add_to_cart(6130, 1, 6147, Array) #17 /www/public/wp-content/plugins/woocommerce/includes/class-wc-form-handler.php(790): WC_Form_Handler::add_to_cart_handler_variable(6130) #18 /www/public/wp-includes/class-wp-hook.php(308): WC_Form_Handler::add_to_cart_action('') #19 /www/public/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters(NULL, Array) #20 /www/public/wp-includes/plugin.php(517): WP_Hook->do_action(Array) #21 /www/public/wp-settings.php(639): do_action('wp_loaded') #22 /www/public/wp-config.php(91): require_once('/www/...') #23 /www/public/wp-load.php(50): require_once('/www/...') #24 /www/public/wp-blog-header.php(13): require_once('/www/...') #25 /www/public/index.php(17): require('/www/...') #26 {main} thrown in /www/public/wp-content/plugins/woocommerce/includes/wc-formatting-functions.php on line 141
-
This reply was modified 2 years, 1 month ago by
Hiren Bhanderi.
Hi @hirenbhanderi ,
Thanks for sharing the error log.
The System Status you shared previously was only part of the report, would you mind sharing the full System Status Report so that we can have a better understanding of your sites current environment.
You can find it via WooCommerce > Status. Select
Get system report
and thenCopy for support
.?Once you’ve done that, paste it here in your response.
Cheers!
Hi @roxannestoltz,
This is this copy of system report.### WordPress Environment ### WC Version: 7.2.2 REST API Version: ?</img> 7.2.2 WC Blocks Version: ?</img> 8.9.2 Action Scheduler Version: ?</img> 3.4.0 Log Directory Writable: ?</img> WP Version: 6.1.1 WP Multisite: – WP Memory Limit: 256 MB WP Debug Mode: – WP Cron: ?</img> Language: en_US External object cache: – ### Server Environment ### Server Info: nginx/1.21.3 PHP Version: 8.0.26 PHP Post Max Size: 128 MB PHP Time Limit: 300 PHP Max Input Vars: 10000 cURL Version: 7.68.0 OpenSSL/1.1.1g SUHOSIN Installed: – MySQL Version: 10.3.37-MariaDB-0ubuntu0.20.04.1 Max Upload Size: 128 MB Default Timezone is UTC: ?</img> fsockopen/cURL: ?</img> SoapClient: ?</img> DOMDocument: ?</img> GZip: ?</img> Multibyte String: ?</img> Remote Post: ?</img> Remote Get: ?</img> ### Database ### WC Database Version: 7.2.0 WC Database Prefix: wp_ Total Database Size: 333.99MB Database Data Size: 259.54MB Database Index Size: 74.45MB wp_woocommerce_sessions: Data: 0.05MB + Index: 0.02MB + Engine InnoDB wp_woocommerce_api_keys: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_woocommerce_attribute_taxonomies: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_woocommerce_downloadable_product_permissions: Data: 0.02MB + Index: 0.06MB + Engine InnoDB wp_woocommerce_order_items: Data: 2.36MB + Index: 1.47MB + Engine InnoDB wp_woocommerce_order_itemmeta: Data: 14.52MB + Index: 13.03MB + Engine InnoDB wp_woocommerce_tax_rates: Data: 0.02MB + Index: 0.06MB + Engine InnoDB wp_woocommerce_tax_rate_locations: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_woocommerce_shipping_zones: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_woocommerce_shipping_zone_locations: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_woocommerce_shipping_zone_methods: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_woocommerce_payment_tokens: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_woocommerce_payment_tokenmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_woocommerce_log: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_actionscheduler_actions: Data: 1.02MB + Index: 0.13MB + Engine InnoDB wp_actionscheduler_claims: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_actionscheduler_groups: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_actionscheduler_logs: Data: 1.02MB + Index: 0.03MB + Engine InnoDB wp_commentmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_comments: Data: 6.52MB + Index: 8.06MB + Engine InnoDB wp_eg_galleries: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_gf_addon_feed: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_gf_draft_submissions: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_gf_entry: Data: 0.25MB + Index: 0.06MB + Engine InnoDB wp_gf_entry_meta: Data: 1.52MB + Index: 0.88MB + Engine InnoDB wp_gf_entry_notes: Data: 0.16MB + Index: 0.03MB + Engine InnoDB wp_gf_form: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_gf_form_meta: Data: 0.11MB + Index: 0.00MB + Engine InnoDB wp_gf_form_revisions: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_gf_form_view: Data: 0.28MB + Index: 0.27MB + Engine InnoDB wp_gf_rest_api_keys: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_links: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_loginizer_logs: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_options: Data: 6.11MB + Index: 2.06MB + Engine InnoDB wp_pimwick_gift_card: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_pimwick_gift_card_activity: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_postmeta: Data: 142.47MB + Index: 35.09MB + Engine InnoDB wp_posts: Data: 61.19MB + Index: 3.53MB + Engine InnoDB wp_redirection_404: Data: 1.02MB + Index: 0.08MB + Engine InnoDB wp_redirection_groups: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_redirection_items: Data: 0.05MB + Index: 0.09MB + Engine InnoDB wp_redirection_logs: Data: 0.13MB + Index: 0.05MB + Engine InnoDB wp_rg_form: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_rg_form_meta: Data: 0.05MB + Index: 0.00MB + Engine InnoDB wp_rg_form_view: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_rg_incomplete_submissions: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_rg_lead: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_rg_lead_detail: Data: 0.02MB + Index: 0.06MB + Engine InnoDB wp_rg_lead_detail_long: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_rg_lead_meta: Data: 0.02MB + Index: 0.05MB + Engine InnoDB wp_rg_lead_notes: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_termmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_terms: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_term_relationships: Data: 0.05MB + Index: 0.02MB + Engine InnoDB wp_term_taxonomy: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_usermeta: Data: 1.52MB + Index: 1.81MB + Engine InnoDB wp_users: Data: 0.09MB + Index: 0.05MB + Engine InnoDB wp_wc_admin_notes: Data: 0.08MB + Index: 0.00MB + Engine InnoDB wp_wc_admin_note_actions: Data: 0.05MB + Index: 0.02MB + Engine InnoDB wp_wc_category_lookup: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_wc_customer_lookup: Data: 1.44MB + Index: 0.69MB + Engine InnoDB wp_wc_download_log: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_wc_order_coupon_lookup: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_wc_order_product_lookup: Data: 1.36MB + Index: 1.19MB + Engine InnoDB wp_wc_order_stats: Data: 1.39MB + Index: 0.81MB + Engine InnoDB wp_wc_order_tax_lookup: Data: 1.44MB + Index: 0.73MB + Engine InnoDB wp_wc_product_attributes_lookup: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_wc_product_download_directories: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_wc_product_meta_lookup: Data: 0.02MB + Index: 0.09MB + Engine InnoDB wp_wc_rate_limits: Data: 1.52MB + Index: 1.52MB + Engine InnoDB wp_wc_reserved_stock: Data: 1.52MB + Index: 0.00MB + Engine InnoDB wp_wc_tax_rate_classes: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_wc_webhooks: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_wc_zapier_history: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_wfblockediplog: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_wfblocks7: Data: 0.02MB + Index: 0.05MB + Engine InnoDB wp_wfconfig: Data: 1.45MB + Index: 0.00MB + Engine InnoDB wp_wfcrawlers: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_wffilechanges: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_wffilemods: Data: 3.52MB + Index: 0.00MB + Engine InnoDB wp_wfhits: Data: 0.08MB + Index: 0.05MB + Engine InnoDB wp_wfhoover: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_wfissues: Data: 0.06MB + Index: 0.06MB + Engine InnoDB wp_wfknownfilelist: Data: 1.52MB + Index: 0.00MB + Engine InnoDB wp_wflivetraffichuman: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_wflocs: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_wflogins: Data: 0.11MB + Index: 0.03MB + Engine InnoDB wp_wfls_2fa_secrets: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_wfls_settings: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_wfnotifications: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_wfpendingissues: Data: 0.02MB + Index: 0.06MB + Engine InnoDB wp_wfreversecache: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_wfsnipcache: Data: 0.02MB + Index: 0.05MB + Engine InnoDB wp_wfstatus: Data: 0.14MB + Index: 0.09MB + Engine InnoDB wp_wftrafficrates: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_wpforms_entries: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_wpforms_entry_fields: Data: 0.02MB + Index: 0.05MB + Engine InnoDB wp_wpforms_entry_meta: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_wpforms_tasks_meta: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_yoast_indexable: Data: 1.39MB + Index: 0.61MB + Engine InnoDB wp_yoast_indexable_hierarchy: Data: 0.09MB + Index: 0.16MB + Engine InnoDB wp_yoast_migrations: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_yoast_primary_term: Data: 0.05MB + Index: 0.03MB + Engine InnoDB wp_yoast_seo_links: Data: 0.45MB + Index: 0.27MB + Engine InnoDB wp_yoast_seo_meta: Data: 0.11MB + Index: 0.00MB + Engine InnoDB ### Post Type Counts ### acf-field: 69 acf-field-group: 8 amp_validated_url: 12 attachment: 887 custom-css-js: 1 custom_css: 1 mc4wp-form: 1 nav_menu_item: 61 newsletters: 42 oembed_cache: 12 page: 84 past-events: 136 patients: 19 post: 94 product: 18 product_variation: 37 research-ga: 13 research-gp: 11 research-published: 21 revision: 1917 shop_coupon: 1 shop_order: 9271 shop_order_refund: 2 specialist: 40 tribute: 12 videos: 161 webinars: 6 woo_discount: 2 woo_discount_cart: 1 wpforms: 1 ### Security ### Secure connection (HTTPS): ?</img> Hide errors from visitors: ?</img> ### Active Plugins (37) ### ManageWP - Worker: by GoDaddy – 4.9.16 Gravity Forms: by Gravity Forms – 2.6.9 Admin Menu Editor: by Janis Elsts – 1.10.4 Advanced Custom Fields PRO: by WP Engine – 6.0.7 AMP: by AMP Project Contributors – 2.3.0 WooCommerce CardPointe Payment Gateway: by Fiserv – 3.3.5 Classic Editor: by WordPress Contributors – 1.6.2 Double the Donation: by Double the Donation – 1.1.2 Enable Media Replace: by ShortPixel – 4.0.1 Everest Gallery: by AccessPress Themes – 1.0.4 Gravity Forms Engage Add-On: by Cornershop Creative – 1.1.0 Gravity Forms Constant Contact Add-On: by Gravity Forms – 1.7 Gravity Forms reCAPTCHA Add-On: by Gravity Forms – 1.1 Highlight Search Terms: by RavanH – 1.8.2 Loginizer: by Softaculous – 1.7.6 MC4WP: Mailchimp for WordPress: by ibericode – 4.8.12 Post Type Switcher: by Triple J Software Inc. – 3.2.1 Really Simple SSL: by Really Simple Plugins – 6.1.1 Redirection: by John Godley – 5.3.6 Show Current Template: by JOTAKI Taisuke – 0.4.6 Page Builder by SiteOrigin: by SiteOrigin – 2.20.3 SiteOrigin Widgets Bundle: by SiteOrigin – 1.46.1 WooCommerce Free Shipping Per Product: by WPRuby – 1.2.3 WooCommerce ShipperHQ: by ShipperHQ – 1.5.0 WooCommerce Anti Fraud: by OPMC Australia Pty Ltd – 4.9 (update to version 5.0.0 is available) WP Menu Cart: by WP Overnight – 2.13.0 WooCommerce Shipping & Tax: by WooCommerce – 2.1.1 (update to version 2.2.2 is available) WooCommerce USPS Shipping: by WooCommerce – 4.4.41 (update to version 4.6.2 is available) WooCommerce - ShipStation Integration: by WooCommerce – 4.3.2 WooCommerce Zapier: by OM4 – 2.0.3 (update to version 2.3.1 is available) WooCommerce: by Automattic – 7.2.2 (update to version 7.3.0 is available) Yoast SEO: by Team Yoast – 20.1 WP-PageNavi: by Lester 'GaMerZ' Chan – 2.94.0 WP reCaptcha Integration: by weDevs – 1.2.5 WPForms: by WPForms – 1.7.9 WPS Hide Login: by WPServeur NicolasKulka wpformation – 1.9.6 YITH WooCommerce Product Bundles: by YITH – 1.18.0 ### Inactive Plugins (5) ### ACF: Better Search: by Mateusz Gbiorczyk – 4.0.1 Gravity Forms Constant Contact Add-On: by Katz Web Services Inc. – 3.1.1 Gravity Forms Salsa Add-On: by Cornershop Creative – 1.0.5 reCAPTCHA for WooCommerce: by Elliot Sowersby RelyWP – 1.2.8 WPForms Lite: by WPForms – 1.7.8 ### Must Use Plugins (2) ### Kinsta Must-use Plugins: by Kinsta Team – 3.0.0 ManageWP - Worker Loader: by GoDaddy – ### Settings ### API Enabled: – Force SSL: – Currency: USD ($) 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) variable (variable) yith_bundle (yith_bundle) 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: ?</img> Enforce Approved Product Download Directories: – Order datastore: WC_Order_Data_Store_CPT ### WC Pages ### Shop base: #1548 - /shop/ Cart: #1549 - /cart/ Checkout: #1550 - /checkout/ My account: #1551 - /my-account/ Terms and conditions: ?</img> Page not set ### Theme ### Name: Version: (update to version 0 is available) Author URL: Child Theme: ?</img> – 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: ?</img> Not declared ### Templates ### Overrides: threshold/single-product.php version - is out of date. The core version is 1.6.4 Outdated Templates: ?</img> Learn how to update ### Admin ### Enabled Features: activity-panels analytics coupons customer-effort-score-tracks experimental-products-task experimental-import-products-task experimental-fashion-sample-products shipping-smart-defaults shipping-setting-tour homescreen marketing multichannel-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: minified-js new-product-management-experience settings Daily Cron: ?</img> Next scheduled: 2023-02-09 11:01:56 +00:00 Options: ?</img> Notes: 115 Onboarding: completed ### Action Scheduler ### Complete: 134 Oldest: 2023-01-08 16:11:32 +0000 Newest: 2023-02-08 00:04:05 +0000 Failed: 2 Oldest: 2020-07-29 16:32:00 +0000 Newest: 2020-07-29 18:16:17 +0000 Pending: 8 Oldest: -0001-11-30 00:00:00 +0000 Newest: 2023-02-15 00:04:05 +0000 ### WooCommerce Zapier ### Database Version: ?</img> 12 Detailed Logging Enabled: No Legacy Mode Disabled: ?</img> Yes REST API Authentication Key(s): ?</img> 0 Task History Record Count: ?</img> 0 ### Status report information ### Generated at: 2023-02-08 12:45:16 +00:00
Hi @hirenbhanderi ,
Thanks for sharing the System Status!
WC Version: 7.2.2 WC Database Version: 7.2.0
As per the status report, I am able to see that you have an outdated version of WooCommerce, as well as an outdated WooCommerce Database version, which does not match the WooCommerce core version.
As a first step, please could you update these, in order to obtain optimal functionality? Here is a guide on how to update WooCommerce:
Additionally, please update your WooCommerce Database to match the core version. This can be done via WooCommerce → Status → Tools → Update database.
Here is more detailed documentation on this.
Please ensure that you have a good?backup?of your?full site and database?in place before doing the updates, so that, should something go wrong, you are able to easily restore your site to a functioning state.
Let us know how this goes!
Hi @roxannestoltz and @hirenbhanderi,
I came here after encountering a Google search for this issue.
I found the culprit
$price += (float) $total;
On line 97 of
gravityforms-product-addons-cart.php
If you write
$price = (float) $price + (float) $total;
then it will proces the values correctly.But, I just updated to version 3.5.0 and the error also went away, so @hirenbhanderi, try again with this version.
Kinds regards,
Jaime MartinezHi Jaime,
Thanks a ton for sharing your discovery, and kudos on your tip about modifying line 97 in
gravityforms-product-addons-cart.php
.Also, good call on updating to version 3.5.0, this may be helpful for others experiencing this same issue, looking for a fix.
Cheers!
-
This reply was modified 2 years, 1 month ago by
- The topic ‘Fatal error while adding Product Bundle to cart in php 8’ is closed to new replies.