fix discount calculation
This commit is contained in:
parent
3a0ee18ceb
commit
36d973dbae
@ -104,12 +104,12 @@ class WC_Retailcrm_Order_Item extends WC_Retailcrm_Abstracts_Data
|
||||
*/
|
||||
private function calculate_discount(WC_Order_Item_Product $item, $price)
|
||||
{
|
||||
$product_price = max(0, round($item->get_total() ? $item->get_total() / $item->get_quantity() : 0));
|
||||
$product_price = $item->get_total() ? $item->get_total() / $item->get_quantity() : 0;
|
||||
$product_tax = $item->get_total_tax() ? $item->get_total_tax() / $item->get_quantity() : 0;
|
||||
$price_item = $product_price + $product_tax;
|
||||
$discount_price = max(0, round($price)) - $price_item;
|
||||
$discount_price = $price - $price_item;
|
||||
|
||||
return $discount_price;
|
||||
return round($discount_price, 2);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user