I will try to free some time in the next months to look at this and contribute.
Could you please elaborate more on the WP Multisite issues?
Hi Jamie,
now ‘wc_reduce_stock_levels()’ checks if the stock has already been reduced for every order item (with the ‘_reduced_stock’ item meta) and if the stock reduction has already been fired on the order (with the ‘_order_stock_reduced’ post meta).
This is how i’ve fixed the issue:
// Reset stock reduction for new order items
foreach ( $order->get_items() as $item ) {
$item->delete_meta_data( ‘_reduced_stock’ );
}
// Reset stock reduction for new order
update_post_meta( $order_id, ‘_order_stock_reduced’, wc_bool_to_string( false ) );
// Reduce Order Stock
wc_reduce_stock_levels( $order_id );
// Set status to on hold as payment is not received
$order->update_status( ‘payment-pending’ );