I'm looking to loop over all the products added to an order in the admin before the order is actually submitted. So far the only WooCommerce hooks I have found only allow you access the product items individually.
I was looking for a hook that would fire when a user clicks the recalculate button but actually it could trigger when a user adds a product, tax, shipping method, etc.. I just need to loop over all items added to the order so far.
At the moment I'm using woocommerce_admin_order_item_values
hook but it's a self-contained loop so doesn't allow me to add all my '$item['product_id']' together.
function action_woocommerce_admin_order_item_values( $null, $item, $absint ) {
$item_ids = array($item['product_id']);
}
add_action( 'woocommerce_admin_order_item_values', 'action_woocommerce_admin_order_item_values', 10, 3 );
You can also use -
woocommerce_before_order_itemmeta
Hook but this only accesses each item individually whereas I need to loop over each item in the summary.