Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Is tea commerce inbuilt functionality updates stock value when a finalized order status is changed to cancelled from tea commerce backend?
I need to update back the order line quantity to current stock value when a order status is changed to cancelled.
If not how can we update the stock value?
No, Tea Commerce won't replenish stock values when an order is marked as canceled. If you wanted to achieve this, you'd need to hook into the events system, either the NotificationCenter.Order.PaymentStateChanged event to listen for a canceled payment or a NotificationCenter.Order.OrderStatusChanged to listen for an order being moved to the Canceled order status. From there, you'd need to check the order for the stock amounts to replenish and then call the product service to increase the stock levels for each item:
decimal? stock = ProductService.Instance.GetStock(StoreId, sku);
if (stock != null)
ProductService.Instance.SetStock(StoreId, sku, stock.Value + quantity);
Hope this helps
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted