From 2816b8144574feaecf1c0f1022dba34b655c9d2b Mon Sep 17 00:00:00 2001 From: Dima Uryvskiy Date: Mon, 15 Nov 2021 12:33:37 +0300 Subject: [PATCH] Add transfer of zero shipping cost from CMS --- src/include/class-wc-retailcrm-orders.php | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/include/class-wc-retailcrm-orders.php b/src/include/class-wc-retailcrm-orders.php index bb41eb8..4ec1eb5 100644 --- a/src/include/class-wc-retailcrm-orders.php +++ b/src/include/class-wc-retailcrm-orders.php @@ -343,8 +343,6 @@ if ( ! class_exists( 'WC_Retailcrm_Orders' ) ) : $shipping_method = $shipping['method_id'] . ':' . $shipping['instance_id']; } - $shipping_cost = $shipping['total'] + $shipping['total_tax']; - if (!empty($shipping_method) && !empty($this->retailcrm_settings[$shipping_method])) { $order_data['delivery']['code'] = $this->retailcrm_settings[$shipping_method]; $service = retailcrm_get_delivery_service($shipping['method_id'], $shipping['instance_id']); @@ -358,12 +356,12 @@ if ( ! class_exists( 'WC_Retailcrm_Orders' ) ) : } } - if (!empty($shipping_cost)) { - $order_data['delivery']['cost'] = $shipping_cost; - } - - if (!empty($shipping['total'])) { + if (isset($shipping['total'])) { $order_data['delivery']['netCost'] = $shipping['total']; + + if (isset($shipping['total_tax'])) { + $order_data['delivery']['cost'] = $shipping['total'] + $shipping['total_tax']; + } } }