WordPress.org

Ready to get started?Download WordPress

Forums

WooCommerce Sequential Order Numbers
[resolved] Order number in email subject is not the sequential number (5 posts)

  1. indira14
    Member
    Posted 5 months ago #

    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/

  2. SkyVerge
    Member
    Plugin Author

    Posted 5 months ago #

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

    -- Justin

  3. SkyVerge
    Member
    Plugin Author

    Posted 5 months ago #

    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 :)

  4. indira14
    Member
    Posted 5 months ago #

    Thanks!

    Just to be sure: should I use

    $order->get_order_number()

    or

    $order->get_order_number

    With or without brackets?

  5. SkyVerge
    Member
    Plugin Author

    Posted 5 months ago #

    Use
    $order->get_order_number()
    :)

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.