Add product data to WooCommerce admin order preview

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

add_action('woocommerce_admin_order_item_values', 'my_woocommerce_admin_order_item_values', 10, 3);
function my_woocommerce_admin_order_item_values($product, $item, $item_id = null) {
    // Only for "line_item" items type, to avoid errors
    if( ! $item->is_type('line_item') ) return;
    
    echo '<td>' . get_the_term_list( $product->get_id(), 'pa_location', '', ',', '' ) . '</td>';
}

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

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top