Display Order Item Meta in WooCommerce 3.1+

I was working on a site that had just been upgraded to WooCommerce 3.1.0 when I received the following notice:

I managed to track down where this was being called. It was attempting to display the order item meta like so:

So the notice is telling me that this is deprecated now. However, it didn’t really tell me what to do instead.

To save you a bit of time, I thought I’d post the solution here. I assumed that the order item meta would also be displayed in order emails. This led me to track down a function added in WooCommerce 3.0.0.

Instead of constructing the class as above, you can simply do this:

Much easier! You don’t even need to prepare a $product┬ábeforehand.

Leave a Reply

Your email address will not be published. Required fields are marked *