bobbingwide / vgc

VGC - Garden Vista Group theme
GNU General Public License v2.0
0 stars 0 forks source link

Fatal error attempting to display an incomplete product #66

Open bobbingwide opened 11 months ago

bobbingwide commented 11 months ago

I created a new test product to test an issue with gvg_bulk_update and attempted to view it. It was almost completely undefined except for the title and dimensions; the editor wouldn't allow me to save the product without specifying the width and height. On the front end the following Fatal was displayed.

Fatal error: Uncaught TypeError: number_format(): Argument #1 ($num) must be of type float, string given in C:\apache\htdocs\wordpress\wp-content\themes\vgc\woocommerce\content-single-product.php:111 Stack trace:

#0 C:\apache\htdocs\wordpress\wp-content\themes\vgc\woocommerce\content-single-product.php(111): number_format('', 2) 
#1 C:\apache\htdocs\gardenvista\wp-includes\template.php(792): require('C:\\apache\\htdoc...') 
#2 C:\apache\htdocs\gardenvista\wp-content\plugins\woocommerce\includes\wc-core-functions.php(284): load_template('C:\\apache\\htdoc...', false) 
#3 C:\apache\htdocs\gardenvista\wp-content\plugins\woocommerce\templates\single-product.php(37): wc_get_template_part('content', 'single-product') 
#4 C:\apache\htdocs\gardenvista\wp-includes\template-loader.php(106): include('C:\\apache\\htdoc...') 
#5 C:\apache\htdocs\gardenvista\wp-blog-header.php(19): require_once('C:\\apache\\htdoc...') 
#6 C:\apache\htdocs\gardenvista\index.php(17): require('C:\\apache\\htdoc...') 
#7 {main} thrown in C:\apache\htdocs\wordpress\wp-content\themes\vgc\woocommerce\content-single-product.php on line 111

Problem occurs in PHP 8.0 as well as 8.1 and 8.2.

bobbingwide commented 11 months ago

This problem occurs when the price is not set. The gvg_product_range plugin also fails when the price is not set.

Workaround