ATUM Multi-Inventory
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
// must fill $_POST add_action( 'woocommerce_checkout_phone_order_processed', function ( $order_id, $checkout_data, $order ) { if ( class_exists( "AtumMultiInventory\Models\Inventory" ) ) { $oi_inventory_qty = array(); foreach ( $order->get_items() as $item ) { $inventories = array(); foreach ( AtumMultiInventory\Models\Inventory::get_order_item_inventories( $item->get_id() ) as $inventory ) { $inventories[ $inventory->inventory_id ] = $inventory->qty; } $oi_inventory_qty[ $item->get_id() ] = $inventories; } $_POST['oi_inventory_qty'] = $oi_inventory_qty; } }, 10, 3 ); |