• Resolved sguha007

    (@sguha007)


    Hello,

    We need to change the invoice number with the dynamic value. The value is stored in the database. Can you please help me how can I do it?

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

    (@baaaaas)

    You can change the invoice number format by using the settings. If you would like to develop your own format you can use the filter bewpi_invoice_number.

    Thread Starter sguha007

    (@sguha007)

    Hello,

    Thank you for your email.

    Should I use “bewpi_invoice_number” filter like below example:

    add_filter( ‘bewpi_invoice_number’, ‘change_invoice_number’ );
    function change_invoice_number($post) {
    return esc_html(get_post_meta( $post->ID, ‘invoice_id’, true ));
    }

    Can you please advise?

    Plugin Author Bas Elbers

    (@baaaaas)

    add_filter( 'bewpi_formatted_invoice_number', 'change_invoice_number' );
    function change_invoice_number($invoice_number, $invoice_type) {
    if ( $invoice_type !== 'invoice/simple' ) {
    return $invoice_number;
    }
    
    global $post;
    return esc_html(get_post_meta( $post->ID, 'invoice_id', true ));
    }

    I think something like this should work.
    The next update will have multiple filters to change the invoice numbering and will also have the $invoice object available.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How to change invoice number’ is closed to new replies.