• Resolved ABCwebsites

    (@abcwebsites)


    I’d like to show the invoice number in the ‘completed order’ customer email. Is there a merge tag I can use for this? I’m looking for something similar to {order_number} and {store_name}.

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

    (@kluver)

    Hi @abcwebsites,

    With the following code snippet you can add the {invoice_number} placeholder:

    add_filter( 'woocommerce_email_format_string' , 'wpo_wcpdf_email_placeholders', 20, 2 );
    function wpo_wcpdf_email_placeholders( $string, $email ) {
        if ( strpos( $string, '{invoice_number}' ) !== false && !empty($email->object) && $invoice = wcpdf_get_invoice( $email->object, true ) ) {
            return str_replace( '{invoice_number}', $invoice->get_number()->get_formatted(), $string );
        }  
        return $string;
    }

    This code snippet should be added to the functions.php of your child theme or with a plugin like Code Snippets. If you haven’t worked with code snippets or functions.php before please read this: How to use filters

    • This reply was modified 5 years ago by kluver.
    Thread Starter ABCwebsites

    (@abcwebsites)

    Works perfectly, thank you.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Merge tags for invoice number’ is closed to new replies.