I have a custom taxonomy for woocommerce products like seasons. I'd like to display what season of product is placed in the admin order detail.
CodePudding user response:
To do this add the following lines of code at the end of your theme’s functions.php file:
add_action('woocommerce_before_order_itemmeta','woocommerce_before_order_itemmeta',10,3);
function woocommerce_before_order_itemmeta($item_id, $item, $product){
echo '<p>'.get_the_term_list($product->id, 'product_cat').'</p>';
}
Save the file by clicking on update file button after placing the above code.
Now if you move to an order from backend again you’ll see category name listed under products in order.