DivisionByZeroError: Modulo by zero
-
Hello,
WooCommerce Version: 9.6.1
Silent Theme Version: 17.0.7I am experiencing a WordPress Fatal Error related to “Uncaught DivisionByZeroError: Modulo by zero”:
Fatal error: Uncaught DivisionByZeroError: Modulo by zero in /public_html/wp-content/plugins/woocommerce/includes/wc-template-functions.php:485 Stack trace: #0 /public_html/wp-content/plugins/woocommerce/includes/wc-template-functions.php(674): wc_get_loop_class() #1 /public_html/wp-content/plugins/woocommerce/includes/wc-template-functions.php(749): wc_get_product_class() #2 /public_html/wp-content/themes/salient/woocommerce/content-product.php(65): wc_product_class() #3 /public_html/wp-includes/template.php(812): require('/home/1122101.c...') #4 /public_html/wp-content/plugins/woocommerce/includes/wc-core-functions.php(284): load_template() #5 /public_html/wp-content/plugins/woocommerce/templates/archive-product.php(62): wc_get_template_part() #6 /public_html/wp-content/plugins/woocommerce/includes/wc-core-functions.php(345): include('/home/1122101.c...') #7 /public_html/wp-content/plugins/woocommerce/templates/taxonomy-product-cat.php(22): wc_get_template() #8 /public_html/wp-includes/template-loader.php(106): include('/home/1122101.c...') #9 /public_html/wp-blog-header.php(19): require_once('/home/1122101.c...') #10 /public_html/index.php(17): require('/home/1122101.c...') #11 {main} thrown in /public_html/wp-content/plugins/woocommerce/includes/wc-template-functions.php on line 485I fixed it temporarily by editing wc-template-functions.php:
function wc_get_loop_class() {
$loop_index = wc_get_loop_prop( 'loop', 0 );
$columns = absint( max( 1, wc_get_loop_prop( 'columns', wc_get_default_products_per_row() ) ) );
if ($columns === 0) {
$columns = 1; // Zabezpieczenie przed dzieleniem przez zero
}
++$loop_index;
wc_set_loop_prop( 'loop', $loop_index );
if ( 0 === ( $loop_index - 1 ) % $columns || 1 === $columns ) {
return 'first';
}
if ( 0 === $loop_index % $columns ) {
return 'last';
}
return '';
}I have already written to the theme creators.
Thanks
The page I need help with: [log in to see the link]
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
The topic ‘DivisionByZeroError: Modulo by zero’ is closed to new replies.