Woocommerce get_item() function returns false

Viewed 1288

With WooCommerce 3+ introducing new API to fetch the order and it's details, a lot of things have changed and many things break as well.

Consider the following code in my plugin:

$order = wc_get_order($order_id);
$id= 27;

var_dump($order->get_item($id));

which gives me bool(false). I have checked the database and the order and the item does exist.

Also

var_dump($order) does return the entire order object with all the items.

So basically, only the function get_item does not seem to work.

1 Answers
Related