Skip to content
Advertisement

Add product data to WooCommerce admin order preview

I used this code for displaying the product attributes in the order details/editor

JavaScript

And it seems to work, but there is an error in the admin panel:

Fatal error: Uncaught Error: Call to a member function get_id() on null

Help me figure it out, I don’t understand why this is happening.

Advertisement

Answer

To avoid your issue, you need to target only order “line” items on your 2nd function, this way:

JavaScript

Code goes in functions.php file of the active child theme (or active theme). Tested and works.

Related: Add product short description to Woocommerce admin orders preview

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement