From 9113a89cd2bc1c78ed408a58d415243a8fc943cc Mon Sep 17 00:00:00 2001 From: Dima Uryvskiy Date: Thu, 24 Feb 2022 18:56:48 +0300 Subject: [PATCH] Add transfer of order numbers from CMS to CRM by history sync --- src/include/class-wc-retailcrm-history.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/include/class-wc-retailcrm-history.php b/src/include/class-wc-retailcrm-history.php index 15a850d..7ffe18e 100644 --- a/src/include/class-wc-retailcrm-history.php +++ b/src/include/class-wc-retailcrm-history.php @@ -246,6 +246,16 @@ if (!class_exists('WC_Retailcrm_History')) : $wcOrder->calculate_totals(); } + if ( + $order['number'] != $wcOrderId + && isset($this->retailcrmSettings['update_number']) + && $this->retailcrmSettings['update_number'] == WC_Retailcrm_Base::YES + ) { + $order['number'] = $wcOrderId; + + $this->retailcrm->ordersEdit($order, 'id'); + } + // @codeCoverageIgnoreStart } catch (Exception $exception) { WC_Retailcrm_Logger::add(