diff --git a/src/include/class-wc-retailcrm-base.php b/src/include/class-wc-retailcrm-base.php index 7c623a6..710a813 100644 --- a/src/include/class-wc-retailcrm-base.php +++ b/src/include/class-wc-retailcrm-base.php @@ -563,20 +563,7 @@ if (!class_exists('WC_Retailcrm_Base')) { return; } - /* as_schedule_single_action( - time() + 2, // when to run? 5 seconds later - 'action_update_order', // the hook name - array( $order_id ), // arguments to pass to the hook and the function - 'updateOrder', // group name, could be any string - true // should be unique? – yes - );*/ $this->orders->updateOrder($order_id); - - /*if (!wp_next_scheduled('action_update_order', [$order_id])) { - wp_schedule_single_event( time() + 2, 'action_update_order', [$order_id] ); - }*/ - - //$this->orders->updateOrder($order_id); } /** diff --git a/src/include/class-wc-retailcrm-orders.php b/src/include/class-wc-retailcrm-orders.php index 31b1e1e..3b37dcf 100644 --- a/src/include/class-wc-retailcrm-orders.php +++ b/src/include/class-wc-retailcrm-orders.php @@ -317,10 +317,12 @@ if (!class_exists('WC_Retailcrm_Orders')) : $this->order_item->cancelLoyalty = false; $needRecalculate = true; + if ($this->loyaltyDiscountType === 'loyalty_level') { + $this->order['privilegeType'] = 'none'; + } + if ($this->loyaltyDiscountType === 'bonus_charge') { $this->retailcrm->cancelBonusOrder(['externalId' => $this->order['externalId']]); - } else { - $this->order['privilegeType'] = 'none'; } }