WordPress.org

Support

Support » Plugins and Hacks » [Resolved] Order number in email subject is not the sequential number

[Resolved] Order number in email subject is not the sequential number

  • I am using a function that adds the order number to the subject of the admin emails. Problem: it’s showing the original WooCommerce order number that’s linked to the post id, and NOT the sequential order number. It’s confusing because the subject line says it’s order #100 when the e-mail itself says it’s order #15 (example).

    Can you tell me how to edit the function to have the sequential order number show up?


    add_filter('woocommerce_email_subject_new_order', 'change_admin_email_subject', 1, 2);

    function change_admin_email_subject( $subject, $order ) {
    global $woocommerce;

    $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);

    $subject = sprintf( '[%s] New Order (# %s) from %s %s', $blogname, $order->id, $order->billing_first_name, $order->billing_last_name );

    return $subject;
    }

    Thanks in advance

    https://wordpress.org/plugins/woocommerce-sequential-order-numbers/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author SkyVerge

    @skyverge

    Hey, this is a pretty easy one, simply replace where you have $order->id with $order->get_order_number()

    — Justin

    Plugin Author SkyVerge

    @skyverge

    Oh, and you’ll probably want to get rid of the explicit ‘#’ in the string as well since that will be included by the order number 🙂

    Thanks!

    Just to be sure: should I use

    $order->get_order_number()

    or

    $order->get_order_number

    With or without brackets?

    Plugin Author SkyVerge

    @skyverge

    Use
    $order->get_order_number()
    🙂

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Resolved] Order number in email subject is not the sequential number’ is closed to new replies.