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

How to Show Shipping Method Data on the Order Edit pages in WooCommerce?

If you are managing an online store on WooCommerce, you might be interested in displaying the shipping method information for each item on the admin page. Fortunately, there is a simple snippet that can help you retrieve all the necessary details in one place.

add_action( 'woocommerce_admin_order_data_after_shipping_address', 'ts_add_pickup_to_order_item_meta', 10, 1 );
function ts_add_pickup_to_order_item_meta( $order ){
    echo '<div>';
    foreach($order->get_shipping_methods() as $shipping_method ){
        echo '<p><strong>Shipping Method ID:</strong> '. $shipping_method->get_method_id().'<br>
        <strong>Shipping Method name:</strong> '. $shipping_method->get_name().'<br>
        <strong>Shipping Method title:</strong> '. $shipping_method->get_method_title().'<br>
        <strong>Shipping Method Total:</strong> '. $shipping_method->get_total().'<br>
        <strong>Shipping Method Total tax:</strong> '. $shipping_method->get_total_tax().'</p><br>';
    }
    echo '</div>';
}

Output

This snippet adds a section to the order admin page, displaying detailed information about each shipping method used in the order, including ID, name, title, total cost, and tax.

How to Show Shipping Method Data on the Order Edit pages in WooCommerce?

You can also add custom fields to WooCommerce Products subsequently through the order cycle, save the field values chosen during the checkout, and also display it in the admin order edit pages.

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

Share It:

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