You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
WooCommerce now has a function wc_maybe_adjust_line_item_product_stock() defined in wc-admin-functions.php to adjust stock quantity when an order item is deleted. This function is called by wc_save_order_items() and WC_AJAX::remove_order_item(). You may want to add this function and its calls to ClassicCommerce.
N.B. The function wc_maybe_adjust_line_item_product_stock() use the data base field '_restock_refunded_items' of table $wpdb->prefix . 'woocommerce_order_items'. This data base field did not exists for order version less than 5.5. However, it can be created using the function WC_Order::get_qty_refunded_for_item(). (See RestockRefundedItemsAdjuster::initialize_restock_refunded_items())
N.B. I think when this featured was first introduced into WooCommerce it may have also introduced a bug. See issue woocommerce/woocommerce#29502. I checked and this bug does not exists in ClassicCommerce 1.0.4. So, it was introduced sometime later, maybe by the introduction of this feature. So some care should be taken implementing this.
The text was updated successfully, but these errors were encountered:
wc_maybe_adjust_line_item_product_stock() WC 3.6.0
Sees if line item stock has already reduced stock, and whether those values need adjusting e.g. after changing item qty.
We are a little short on developers at the moment but will keep it in mind.
WooCommerce now has a function wc_maybe_adjust_line_item_product_stock() defined in wc-admin-functions.php to adjust stock quantity when an order item is deleted. This function is called by wc_save_order_items() and WC_AJAX::remove_order_item(). You may want to add this function and its calls to ClassicCommerce.
N.B. The function wc_maybe_adjust_line_item_product_stock() use the data base field '_restock_refunded_items' of table $wpdb->prefix . 'woocommerce_order_items'. This data base field did not exists for order version less than 5.5. However, it can be created using the function WC_Order::get_qty_refunded_for_item(). (See RestockRefundedItemsAdjuster::initialize_restock_refunded_items())
N.B. I think when this featured was first introduced into WooCommerce it may have also introduced a bug. See issue woocommerce/woocommerce#29502. I checked and this bug does not exists in ClassicCommerce 1.0.4. So, it was introduced sometime later, maybe by the introduction of this feature. So some care should be taken implementing this.
The text was updated successfully, but these errors were encountered: