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

    (@pomegranate)

    Sorting of unformatted invoice numbers is problematic because there can be many different formats. Most shops actually apply a padding (000010, 000123 etc.) and/or prefix to the number and we can’t sort an invoice ‘number’ like XYZ000123-WEB as an actual number (integer) because it would give unexpected results. For that reason we have chosen to do a flat alfanumeric sorting. If you want to override this and apply numeric sorting, you can use a filter:

    
    add_filter( 'wpo_wcpdf_invoice_number_column_orderby', function(){ return 'meta_value_num'; } );
    

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

    Thread Starter Yiannis Christodoulou

    (@yiannistaos)

    Great! 🙂
    It works like a charm.

    Thank you, Ewout.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Sort column by invoice number doesn’t count correctly’ is closed to new replies.