Support » Plugin: WooCommerce PDF Invoices & Packing Slips » Order Number being passed to Xero Invoice field

  • Resolved mmanenica

    (@mmanenica)


    Hi there

    I am using the Xero Integration plugin to send invoices from Woocommerce to Xero. The number that is being passed to the Invoice field in Xero is the Order number from Woocommerce (not the Invoice Number in Xero).

    Is it possible to change this so that the Invoice Number from Woocommerce is being passed to the Invoice Number in Xero?

    Cheers

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Ewout

    (@pomegranate)

    Hi! This is something you’ll have to ask the Xero Integration plugin developers, as this appears to be a paid plugin, I can’t see whether there are any filters available for this. If there are and they can provide the details of these filter hooks, I’d happily supply you with a function that will let Xero use the invoice number from this plugin instead1

    Hi @pomegranate, I believe the filter needed is woocommerce_xero_invoice_invoice_number

    I have read that with this it should be possible to return null from a custom function hooked into the filter, and this would enable Xero to start creating the invoice numbers.

    Do you know what the function would need to be for this?

    Thanks!

    Plugin Author Ewout

    (@pomegranate)

    Without having more information on the filter arguments it’s not possible to know what data is available to read the invoice number from, but looking at a 4 year old version of the plugin I found on Github, I think the following may work:

    
    add_filter('woocommerce_xero_invoice_invoice_number','wpo_wcpdf_xero_invoice_number',10,2);
    function wpo_wcpdf_xero_invoice_number( $invoice_number, $xero_invoice ) {
    	if ( !empty( $xero_invoice->order ) && $pdf_invoice = wcpdf_get_invoice( $xero_invoice->order, true ) ) {
    		if ( $pdf_invoice_number = $pdf_invoice->get_number() ) {
    			$invoice_number = $pdf_invoice_number->get_formatted();
    		}
    	}
    	return $invoice_number;
    }
    

    Should this not work, I recommend taking this up with WooCommerce XERO support, with the above information they will be able to help you.

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.