From d8bbbc2d8a77f0aa557eb8170ee2d31f514b490e Mon Sep 17 00:00:00 2001 From: Sergey Date: Fri, 12 Apr 2019 12:46:04 +0300 Subject: [PATCH] fix send empty order number --- src/include/order/class-wc-retailcrm-order.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/include/order/class-wc-retailcrm-order.php b/src/include/order/class-wc-retailcrm-order.php index 69d529c..760f880 100644 --- a/src/include/order/class-wc-retailcrm-order.php +++ b/src/include/order/class-wc-retailcrm-order.php @@ -97,11 +97,18 @@ class WC_Retailcrm_Order extends WC_Retailcrm_Abstracts_Data */ protected function set_number($order) { + if ($this->is_new) { + $this->set_data_field('number', $order->get_order_number()); + } + if (isset($this->settings['update_number']) && $this->settings['update_number'] == WC_Retailcrm_Base::YES - && !$this->is_new ) { - $this->set_data_field('number', $order->get_order_number()); + if (!$this->is_new) { + $this->set_data_field('number', $order->get_order_number()); + } + } elseif (!$this->is_new) { + unset($this->data['number']); } }