Hello @snehaladdweb
Unfortunately we are bound by the limitations of WordPress queries here, and it seems that sorting will remove the orders that have empty Invoice numbers. I’m afraid we can’t help much more on this due to that.
Hi @alexmigf
Thanks for your prompt response. I appriate that
I understand that we’ve a limitation of WordPress queries here. Any other workaround which you suggest to meet the requrirement?
Thanks & regards,
Snehal Brahmbhatt
Hi @snehaladdweb,
You can try this code snippet, but as my colleague @alexmigf said, it hides the orders without an invoice:
add_action( 'parse_query', 'wpo_wcpdf_set_orderby_pdf_invoice_number_in_admin' );
function wpo_wcpdf_set_orderby_pdf_invoice_number_in_admin( $query ){
if( is_admin() && $_GET['post_type'] === 'shop_order' ){
if(!isset($_GET['orderby'])) $_GET['orderby'] = 'pdf_invoice_number'; // Invoice Number column
if(!isset($_GET['order'])) $_GET['order'] = 'desc'; //You can change it to ASC
}
}
If you decide to use this code snippet, you’ll need to click on the Orders column heading to change the sort, in order to see the hidden orders (those without an invoice yet).
Hope it helps.
Hi @yordansoares
Thanks for your reply but this will not sort as per my requirement. I would like to see all orders which has no invoice will be last.
Also, It is not sorting the invoice number in proper ASC/DESC format.
You can try with below Invoice Number(s)
– 10009
– 1001
– 10010
It will show you in the same order which I mentioned above for the ASC.