• Resolved steveauchettl

    (@steveauchettl)


    Hi guys – love the plugin! I’m currently editing a template and able to use code such as <?php $this->custom_field('Custom_field'); ?> to display order post meta, but do you know how I can display order items post meta details (order_itemmeta)?
    Thanks
    Steve

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Contributor kluver

    (@kluver)

    hi @steveauchettl,

    Within the item loop you can add the following code to retrieve specific item post meta:

    <?php $item_meta = wc_get_order_item_meta( $item['item_id'], 'item_meta_key', true ); ?>

    Just replace the item_meta_key with the meta key of choice.
    I hope this answers your question.

    Have a great day!

    Michael

    Thread Starter steveauchettl

    (@steveauchettl)

    Hi Michael

    Very helpful thank you – i’ve nearly got it working… once you call the item, then when you then go to show it on the page would you be using something like this? <?php echo $item_meta['item_meta_key']; ?>

    Cheers again! Much appreciated ??

    Plugin Contributor Ewout

    (@pomegranate)

    Hi Steve, with michaels example, the meta data is already in $item_meta. You can also echo it out directly (assuming it’s a string):

    
    <?php echo wc_get_order_item_meta( $item['item_id'], 'item_meta_key', true ); ?>
    

    Ewout

    Thread Starter steveauchettl

    (@steveauchettl)

    Fantastic many thanks!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Order items post meta?’ is closed to new replies.