1
0
mirror of synced 2025-01-30 14:51:42 +03:00

Merge pull request #101 from KMityai/master

Фикс подсчета цены товара
This commit is contained in:
Alex Lushpai 2019-05-07 17:37:22 +03:00 committed by GitHub
commit b7760f21e9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -104,7 +104,7 @@ class WC_Retailcrm_Order_Item extends WC_Retailcrm_Abstracts_Data
*/ */
private function calculate_discount(WC_Order_Item_Product $item, $price) private function calculate_discount(WC_Order_Item_Product $item, $price)
{ {
$product_price = $item->get_total() ? $item->get_total() / $item->get_quantity() : 0; $product_price = max(0, round($item->get_total() ? $item->get_total() / $item->get_quantity() : 0));
$product_tax = $item->get_total_tax() ? $item->get_total_tax() / $item->get_quantity() : 0; $product_tax = $item->get_total_tax() ? $item->get_total_tax() / $item->get_quantity() : 0;
$price_item = $product_price + $product_tax; $price_item = $product_price + $product_tax;
$discount_price = $price - $price_item; $discount_price = $price - $price_item;