I am want to get the category of the items in the cart at the checkout in WooCommerce. I want to extract it and then place it in a field in my custom checkout.
I’m using WooCommerce MultiStep Checkout Wizard premium plugin and a specific hook:
add_action('woocommerce_multistep_checkout_before_order_info', 'destinationStep');
I’m a little lost and can’t find much documentation for what I need to use to get it.
I’m trying to just get items to appear but I just get an empty array.
$order = new WC_Order( $order_id );
$items = $order->get_items();
var_dump($items);
You could try first with your approach “
new WC_Order( $order_id );
“, this way:If it still doesn’t work try with “
new WC_Order($post->ID)
“ approach:Update – After some thought: