• Resolved aon21

    (@aon21)


    Hello,

    How can i get full invoice number with or w/o prefix by passing invoicing_invoice_number_id ?
    I need to pass it to xml export.

Viewing 1 replies (of 1 total)
  • Plugin Contributor Ewout

    (@pomegranate)

    Hi! I’m not sure what you mean by ‘invoicing_invoice_number_id’, there is no such id in use by our plugin (just to be certain, this forum is for WooCommerce PDF Invoices & Packing Slips).
    You can programmatically retrieve the invoice data for a given order/order_id like so:

    
    $order = wc_get_order( $order_id );
    $invoice = wcpdf_get_document( 'invoice', $order );
    if ( $invoice && $invoice->exists() ) {
    	$invoice_number = $invoice->get_number(); // this retrieves the number object with all the data related to the number
    	$invoice_number_formatted = $invoice_number->get_formatted();
    	$invoice_number_plain = $invoice_number->get_plain();
    }
    

    The formatted invoice number is also stored in the order meta as _wcpdf_invoice_number (which may be quicker/more convenient if that’s good enough for your purposes too).

    Hope that helps!

Viewing 1 replies (of 1 total)
  • The topic ‘How can i get invoice number’ is closed to new replies.