Warning: Division by zero (sale-flash.php on line 25)
-
Today I updated the following plugins and theme in localhost before updating them of my live site.
WooCommerce—> Version 3.6.2
WOOCS – WooCommerce Currency Switcher—> Version 1.2.8.1
Porto Theme—> Version 4.11.2 (Apr 23.2019)Now following error message is appeared in variable product page once changed the default currency through WOOCS currency switcher. Please let me how to fix that that error. I am afraid to update my live site without fix this error.
“Warning: Division by zero in C:\xampp\htdocs\mrudukanga.lk\wp-content\themes\porto\woocommerce\single-product\sale-flash.php on line 25”
Screenshots: Product page—> https://prnt.sc/nmqa3v
Currency Settings—> https://prnt.sc/nmrmkzSale-flash.php Code:
<?php /** * Single Product Sale Flash * * @version 1.6.4 */ if ( ! defined( 'ABSPATH' ) ) { exit; } global $post, $product, $porto_settings; $labels = ''; if ($porto_settings['product-hot']) { $featured = $product->is_featured(); if ($featured) { $labels .= '<div class="onhot">'. ((isset($porto_settings['product-hot-label']) && $porto_settings['product-hot-label']) ? $porto_settings['product-hot-label'] : __('Hot', 'porto')) .'</div>'; } } if ( $porto_settings['product-sale'] && $product->is_on_sale() ) { $percentage = 0; if ($product->get_regular_price()) $percentage = - round( ( ( $product->get_regular_price() - $product->get_sale_price() ) / $product->get_regular_price() ) * 100 ); if ($porto_settings['product-sale-percent'] && $percentage) $labels .= '<div class="onsale">'. $percentage .'%</div>'; else $labels .= apply_filters( 'woocommerce_sale_flash', '<span class="onsale">' . ((isset($porto_settings['product-sale-label']) && $porto_settings['product-sale-label']) ? $porto_settings['product-sale-label'] : __('Sale', 'porto')) . '</span>', $post, $product ); } echo '<div class="labels">'; echo $labels; echo '</div>'; ?>
Thank you
- The topic ‘Warning: Division by zero (sale-flash.php on line 25)’ is closed to new replies.