• Resolved niikk

    (@niikk)


    Hello

    We want to display the order number in the E-mail subject. Therefor we use this code snipped here:

    add_filter( 'woocommerce_email_subject_customer_completed_order', 'change_completed_email_subject', 1, 2 );
    
    function change_completed_email_subject( $subject, $order ) {
    global $woocommerce;
    
    $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
    
    $subject = sprintf( '%s, Deine %s Bestellung wurde versendet! %s', $order->billing_first_name, $blogname, $order->get_id() );                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    
    return $subject;
    }

    Its working. But I always takes the “old” or lets say “post ID” number instead the new order from the sequential plugin.

    How can we get that number?

    Cheers

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

    (@webtoffee)

    Hi @niikk,

    Please try using below code:

    add_filter( 'woocommerce_email_subject_customer_completed_order', 'change_completed_email_subject', 1, 2 );
    function change_completed_email_subject( $subject, $order ) {
    global $woocommerce;
    $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
    $subject = sprintf( '%s, Deine %s Bestellung wurde versendet! %s', $order->billing_first_name, $blogname, $order->get_order_number() );
    return $subject;
    }
    Thread Starter niikk

    (@niikk)

    @webtoffee

    Perfect! Thanks

    Plugin Author WebToffee

    (@webtoffee)

    Hi @niikk,

    Glad that you found the snippet helpful. We would really appreciate it if you could leave a review. Thanks!

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