parent
4edd42604b
commit
d929a1fd5f
@ -1,3 +1,6 @@
|
||||
## 2022-12-26 4.5.3
|
||||
* Fix bug with products tax
|
||||
|
||||
## 2022-11-09 4.5.2
|
||||
* Add validator for CRM URL
|
||||
|
||||
|
@ -1066,18 +1066,16 @@ if (!class_exists('WC_Retailcrm_History')) :
|
||||
$wcOrderItem->save();
|
||||
}
|
||||
|
||||
// Be aware that discounts may be added.
|
||||
if (!empty($crmProduct['summ'])) {
|
||||
if (wc_tax_enabled()) {
|
||||
$shippingTaxClass = get_option('woocommerce_shipping_tax_class');
|
||||
$wcOrder = wc_get_order($wcOrderItem->get_order_id());
|
||||
$itemRate = getOrderItemRate($wcOrder);
|
||||
|
||||
$wcOrder = wc_get_order($wcOrderItem->get_order_id());
|
||||
$itemRate = $shippingTaxClass == 'inherit'
|
||||
? getOrderItemRate($wcOrder)
|
||||
: getShippingRate();
|
||||
$itemPrice = calculatePriceExcludingTax($crmProduct['summ'], $itemRate);
|
||||
if ($itemRate === null) {
|
||||
$itemRate = getShippingRate();
|
||||
}
|
||||
|
||||
$wcOrderItem->set_total($itemPrice);
|
||||
$wcOrderItem->set_total(calculatePriceExcludingTax($crmProduct['summ'], $itemRate));
|
||||
} else {
|
||||
$wcOrderItem->set_total($crmProduct['summ']);
|
||||
}
|
||||
|
@ -138,7 +138,10 @@ function is_wplogin()
|
||||
}
|
||||
|
||||
/**
|
||||
* Get shipping rate.
|
||||
* If a tax class with a standart rate is selected, woocommerce_shipping_tax_class = ''
|
||||
* If a tax class with a zero rate is selected, woocommerce_shipping_tax_class = zero-rate
|
||||
* If a tax class with a reduced rate is selected, woocommerce_shipping_tax_class = reduced-rate
|
||||
* If the tax is calculated based on the items in the cart, woocommerce_shipping_tax_class = inherit
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
@ -176,9 +179,7 @@ function getOrderItemRate($wcOrder)
|
||||
|
||||
function calculatePriceExcludingTax($priceIncludingTax, $rate)
|
||||
{
|
||||
$decimalPlaces = wc_get_price_decimals();
|
||||
|
||||
return round($priceIncludingTax / (1 + $rate / 100), $decimalPlaces);
|
||||
return round($priceIncludingTax / (1 + $rate / 100), wc_get_price_decimals());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -5,7 +5,7 @@ Tags: Интеграция, Simla.com, simla
|
||||
Requires PHP: 7.0
|
||||
Requires at least: 5.3
|
||||
Tested up to: 6.0
|
||||
Stable tag: 4.5.2
|
||||
Stable tag: 4.5.3
|
||||
License: GPLv1 or later
|
||||
License URI: http://www.gnu.org/licenses/gpl-1.0.html
|
||||
|
||||
@ -82,6 +82,9 @@ Asegúrate de tener una clave API específica para cada tienda. Las siguientes i
|
||||
|
||||
|
||||
== Changelog ==
|
||||
= 4.5.3 =
|
||||
* Fix bug with products tax
|
||||
|
||||
= 4.5.2 =
|
||||
* Add validator for CRM URL
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
* Description: Integration plugin for WooCommerce & Simla.com
|
||||
* Author: RetailDriver LLC
|
||||
* Author URI: http://retailcrm.pro/
|
||||
* Version: 4.5.2
|
||||
* Version: 4.5.3
|
||||
* Tested up to: 6.0
|
||||
* WC requires at least: 5.4
|
||||
* WC tested up to: 6.9
|
||||
|
@ -16,7 +16,7 @@
|
||||
*
|
||||
* @link https://wordpress.org/plugins/woo-retailcrm/
|
||||
*
|
||||
* @version 4.5.2
|
||||
* @version 4.5.3
|
||||
*
|
||||
* @package RetailCRM
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user