Black Friday & Cyber Monday SUPER SALE ALL WEEK:
Grab 40% OFF on plugins
Days
Hours
Minutes
Seconds

How to Add the Shipping Method To WooCommerce Order Numbers?

If an online store uses several shipping methods then you might be tracking some information about these orders. Instead of digging through order details you can straight away get it when these details are appended to order numbers. Let’s check out this woocommerce customization that allows owners to get an instant view of which shipment providers are been chosen by the customer right from the admin orders page.

add_filter( 'woocommerce_order_number', 'ts_add_shipping_method_to_order_number', 1, 2 );

function ts_add_shipping_method_to_order_number( $order_id, $order ) {
    // Get shipping method
    $shipping_method = $order->get_shipping_method();

    // Concatenate shipping method with order ID
    $order_number_with_shipping = $shipping_method . '-' . $order_id;

    return $order_number_with_shipping;
}

Output

Instead of the standard order numbers, they will now include information about the shipping providers chosen by customers. The shipping method can be added as a prefix or suffix based on your specific implemntation. For example, if a customer selects a shipping method provided by UPS, the order number might appear as “UPS-1234” or “1234-UPS”.

How to Add the Shipping Method To WooCommerce Order Numbers? - Tyche Softwares

If you want to further enhance your order tracking related to payments, instead of appending shipping, you can add payment methods to your order IDs. This helps you understand customer payment preferences and decide which options to promote or discontinue, streamlining payment processes.

Browse more in: Code Snippets, WooCommerce How Tos, WooCommerce Tutorials

Share It:

Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x