Hi robert147,
The export plugin will need to use $order->get_order_number(). You could do something like this in the export plugin
$order_id = get_the_ID();
$order = wc_get_order( $order_id );
$order_number = $order->get_order_number();
Hope that helps!
Cheers,
Tamara
Wow, fast response. I’ll try your suggestion tomorrow and let you know if it worked or not.
It worked. Thanks a lot!!!
Rob
Hi Tamara,
Will the above suggestion work regardless of whether sequential order number is installed or not?
i.e. if it isn’t installed, will it just pull the standard order number, and if it is installed will it get the correct one?
Basically I want to make sure a plugin will work both with and without sequential order numbers installed.
Thanks
Hey shawaj,
The code returns the standard order number when Sequential Order Numbers is not activated so it is the same, and recommended, way to get the order number in WooCommerce π
I posted a reply to the other thread as well: https://wordpress.org/support/topic/will-get_order_number-work-without-sequential-order-numbers?replies=2#post-6680997
Cheers,
Tamara
Thanks! And sorry for double posting, just thought it made more sense to do it in a new thread rather than hijack this one.
@shawaj, no problem at all π It’s generally a good idea to open your own thread and reference another one if needed. -Tamara
I will remember that for next time. Thanks for your speedy replies
Sorry, but I have no idea of what to do with this :
$order_id = get_the_ID();
$order = wc_get_order( $order_id );
$order_number = $order->get_order_number();
Where do I modify this ?
Thanks for help.
Hi Dunanshi,
That code was provided as an example for a custom plugin. Where and how you use this code will depend on the plugin.
If you’re having a specific issue with another plugin which is not using the sequential order number, please create a new support thread here.
Thanks π
Tamara
@skyverge
Hi,
I am in the same case than robert147, I think…
I use woocommerce-sequential-order-numbers and woocommerce-simply-order-export
In the csv file I do not want the post_ID but the sequential_ID.
The code is here if you need to look at it –
https://github.com/wp-plugins/woocommerce-simply-order-export
You should be able to look through that and make changes based on advice above