I´m using Woocommerce with paid addon from automatic "product addon" which adds some meta values to the order item table
I want to show 2 or more specific meta key values in the admin order list.
- 1 Funghi Topup: Salami Oil: chilli
I got the quantity and product name working with this code but not the order item meta, any ideas?
add_action('manage_shop_order_posts_custom_column', 'orders_list_preview_items', 20, 2 );
function orders_list_preview_items($column, $post_id) {
global $the_order, $post;
if ('order_status' === $column) {
// Start list
echo '<ul class="orders-list-items-preview">';
// Loop through order items
foreach($the_order->get_items() as $item) {
$product = $item->get_product();
$name = $item->get_name();
$qty = $item->get_quantity();
$meta = $item->get_meta();
echo "<li>
<label>$qty</label> $name $meta
</li>";
}
// End list
echo '</ul>';
}
}
You can Loop through the item's metadata. and check for only the meta keys that you want to display. check the below code.