Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter Nitrat

    (@nitrat)

    I think I found the solution. In previous answers.
    I added this code in the Woocommerce orders.php:
    <?php global $wpo_wcpdf; echo $wpo_wcpdf->export->get_invoice_number( $order->id );?>

    Thread Starter Nitrat

    (@nitrat)

    With the invoice number clearly. How to pull custom fields?
    For example field Number –

    <?php
    $items = $wpo_wcpdf->get_order_items();
    if( sizeof( $items ) > 0 ) {
    	foreach( $items as $item ) {
    		if (isset($item['item']['item_meta']['Number'])) {
    			$nomer = $item['item']['item_meta']['Number'][0];}
    			
    }
    }
    ?>
    • This reply was modified 8 years, 5 months ago by Nitrat.
    Plugin Contributor Ewout

    (@pomegranate)

    Hello Aleksey,
    Are you using this code on the my account page? I don’t recommend using the PDF functions on the account page. For the PDF invoice, check out this thread: Display order item meta data in custom invoice template

    Hope that helps!
    Ewout

    Thread Starter Nitrat

    (@nitrat)

    Yes, in My account page – Orders.
    I have custom field – Number
    And in Woocommerce orders.php file put this code, don’t show this field
    <?php $meta_key = 'Number'; echo wc_get_order_item_meta( $item_id, $meta_key, true );?>

    • This reply was modified 8 years, 5 months ago by Nitrat.
    • This reply was modified 8 years, 5 months ago by Nitrat.
    Plugin Contributor Ewout

    (@pomegranate)

    That’s because this code only works in the items loop, otherwise $item_id is not available.

    
    <?php
    $items = $order->get_items();
    foreach( $items as $item_id => $item ) {
    	echo wc_get_order_item_meta( $item_id, 'Number', true );?>
    }
    ?>
    

    This is a WooCommerce question and outside of the scope for this plugin support, so unfortunately I cannot help you with this!

    Ewout

    Thread Starter Nitrat

    (@nitrat)

    Big thanks, Ewout!
    This code works!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Invoice number in the orders list’ is closed to new replies.