• Resolved bparker41

    (@bparker41)


    We would like to display the Invoice number on the packing slip, not just the Invoice. We have the setting turned on to display the invoice number and it does display on the Invoice. I looked over the PDF Template and it does have the same action to display invoice number as the Invoice Template does, but it will not display on Packing Slips still. See screenshot here: https://app.screencast.com/5wBqyDgGlT9C4
    Anything else I can try to get it to display. Thank You

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

    (@dpeyou)

    Hey @bparker41,

    Once you’ve made sure the corresponding Invoice Number exists, what happens when you try tihs?
    echo $this->order->get_meta('_wcpdf_invoice_number');


    The result below is using…
    echo $order->get_meta('_wcpdf_invoice_number');
    …via code snippet:
    invoice-number-on-packing-slip

    Thread Starter bparker41

    (@bparker41)

    The Invoice number does get pulled into the Invoice Template when generating the PDF. Are you saying to replace that string with this one in our Packing Slip Template: https://app.screencast.com/aoONJvJErylne

    Plugin Contributor Darren Peyou

    (@dpeyou)

    @bparker41,

    I was using a code snippet. ??

    So if you haven’t worked with code snippets (actions/filters) or functions.php before, read this guide:?How to use filters

    add_action( 'wpo_wcpdf_before_order_data', 'wpo_wcpdf_display_invoice_number_in_packing_slip', 10, 2 );
    function wpo_wcpdf_display_invoice_number_in_packing_slip( $document_type, $order ) {
    	if ( empty( $order ) ) { return; }
    	if ( $document_type == 'packing-slip' ) {
    		?>
    			<tr class="invoice-number">
    				<th>Invoice Number: </th>
    				<td><?php echo $order->get_meta('_wcpdf_invoice_number'); ?></td>
    			</tr>
    		<?php
    	}	
    }
    • This reply was modified 1 year, 7 months ago by Darren Peyou.
    Thread Starter bparker41

    (@bparker41)

    Thank you. I did miss the line where you mentioned it was a Code Snippet and was trying to edit our template. That Snippet did work.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Display Invoice number in Packing Slip’ is closed to new replies.