woocommerce_new_order
fires before order items are assigned to the order, thus making $order->get_items();
return an empty array.
Is there any way to get the items using that hook?
The order is created using wc_new_order
so using woocommerce_checkout_order_processed
won't work.
Is there another hook that could be used?
I'm using The Events Calendar and with it they have a functionality to move an event attendee from one event to another.
I use the hook tribe_tickets_ticket_moved
(https://docs.theeventscalendar.com/reference/hooks/tribe_tickets_ticket_moved/) but for some reason(??) they do not pass the new order_id with the hook. So I resolved myself to check for new orders using woocommerce_new_order
with a couple check to make sure the new order comes from the ticket moving and that its the right one.
They even set parent_id
on the new order, but nothing on the old one to link them together.
I'm not sure how I could access the new order from the ticket_moved
hook, or getting the items in the woocommerce_new_order
hook.