Only restore stock when inventory for order is reduced
-
When WooCommerce reduces the stock for an order a post meta value ‘_order_stock_reduced’ is set to remember the stock is reduced for this order.
Wc_Order::payment_complete() will only reduce stock if post meta value ‘_order_stock_reduced’ hasn’t been set before.
I think your plugin should check if the stock has actually been reduced for the order and skip restoring stock if post meta value ‘_order_stock_reduced’ is not set.
This post meta value is introduced in WooCommerce 2.4.7 Maybe you can only check this value for WooCommerce 2.4.7 and above.
Related to https://www.ads-software.com/support/topic/restoring-items-that-have-not-left-the-stock
https://www.ads-software.com/plugins/woocommerce-auto-restore-stock/
- The topic ‘Only restore stock when inventory for order is reduced’ is closed to new replies.