После обновления woocommerce я получаю предупреждение: ошибка деления на ноль с помощью функции ниже.
Я не понимаю, почему эта ошибка не появлялась раньше, в настоящее время даже при отключенной отладке wp ошибка все еще отображается.
function 6516_product_sale_flash( $output, $post, $product ) {
global $product;
if($product->is_on_sale()) {
if($product->is_type( 'variable' ) )
{
$regular_price = $product->get_variation_regular_price();
$sale_price = $product->get_variation_price();
} else {
$regular_price = $product->get_regular_price();
$sale_price = $product->get_sale_price();
}
$percent_off = round( ( ( $regular_price - $sale_price ) / $regular_price ) * 100 );
return '<span class="onsale">' . 'Save<br>' . round($percent_off) . '%</span>';
}
}
есть идеи, почему это стало проблемой?
Спасибо