Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Contributor Ewout

    (@pomegranate)

    Hi! Currently it’s not, but I intend to add this to the next version – keep an eye on the changelog!

    Ewout

    I have tried adding this with the below code in my functions.asp file but it does not identify any results:

    add_filter( 'woocommerce_shop_order_search_fields', 'woocommerce_shop_order_search_custom_fields' );
    
    function woocommerce_shop_order_search_custom_fields( $search_fields ) {
        $search_fields[] = 'pdf_invoice_number';
        return $search_fields;
    }

    Taken from:
    https://www.skyverge.com/blog/searching-custom-fields-woocommerce-order-admin/

    Is this because the pdf_invoice_number is not stored in the meta_key used by the search filter?

    I was able to get the search to filter not by the full invoice reference (e.g. prefix/suffix) but only the numeric number using the below code:

    add_filter( 'woocommerce_shop_order_search_fields', 'woocommerce_shop_order_search_custom_fields' );
    
    function woocommerce_shop_order_search_custom_fields( $search_fields ) {
        $search_fields[] = '_wcpdf_invoice_number';
        return $search_fields;
    }

    TO make the results work I have started the numbering as follows:
    Invoice = 200001
    Credit = 400001
    Proform = 600001

    It would be great if it could search by the full reference but for now this seems a reasonable work around.

    Thread Starter zubeldialuis

    (@zubeldialuis)

    Greate! thats work fine.

    Thanks…

    Plugin Contributor Ewout

    (@pomegranate)

    Hi There,
    I have added this as a feature to the latest version of the plugin. Unfortunately I did not find a backwards compatible way to search for the formatted invoice number, but I have added an extra custom field to the order that will store the formatted invoice number along with the clean number. This means that for new orders, you will also be able to search the complete formatted number.

    Hope that helps!

    Ewout

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘search orders by invoice number’ is closed to new replies.