Add content behind admin order line item meta

There are moments when you need to add content behind the order line items in your woocommerce admin. In my case for example I needed this to show a reference id stored under a product.

You can get the product id from the $item->get_data(); array.

 * Adds content after order item meta
function th_add_content_after_order_itemmeta( $item_id, $item, $product ) {
   $item_data = $item->get_data();
   $product_id = $item['product_id']; // If you need to do something with the data from the product..
   echo 'Content after order itemmeta';
add_action( 'woocommerce_after_order_itemmeta', 'th_add_content_after_order_itemmeta', 10, 3 );

I'm Robbert Vermeulen. I document everything I learn and help thousands of people with coding WordPress. My site has no ads or sponsors. If you enjoy my content, please consider supporting what I do.


    No comments yet..

Leave a reply

Feel free to ask questions or make comments.