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

How to Hide ‘Shipping Via’ Text from Thank You and View Order Pages in WooCommerce?

Removing unnecessary text elements from order confirmation pages results in an easier-to-understand layout & keeps the focus on essential order details. In the context of WooCommerce, store owners often seek the removal of the ‘Shipping Via’ text from the Thank You and View Order pages. Usually, store owners customize the WooCommerce Thank You page often as that page appears right after an order is placed. So you could present further options like an upsell, order bumps, etc.

This post provides a guide on how to hide the “Shipping Via” text on the WooCommerce view order page.

Where to Add Custom Code in WooCommerce

It is advisable to add the code snippets to the functions.php file of your child theme. Access the file directly from Appearance->Theme File Editor->Locating the child theme’s functions.php from the right sidebar. You can also access it from your theme’s directory file. Insert the following code snippet in functions.php. The alternative & easy option is to install the Code Snippets plugin. You can then add the code as a new snippet via the plugin.

Solution: Hiding the “Shipping Via” text on WooCommerce View Order Page

Below is the code snippet, that helps to hide the “Shipping via” text on both the WooCommerce View Order & Thank You page.

add_filter( 'woocommerce_order_shipping_to_display_shipped_via', '__return_empty_string' );

Output:

In the below output, an order details and its shipping method i.e. “Via Flat rate” text has got hidden on the view order page.

How to Hide 'Shipping Via' Text from Thank You and View Order Pages in WooCommerce? - Tyche Softwares

Here, another output shows the ” Via Flat rate” text has also got hidden on the thank you page after the checkout page as shown below.

How to Hide 'Shipping Via' Text from Thank You and View Order Pages in WooCommerce? - Tyche Softwares

Code Explanation:

This code snippet uses the add_filter function to modify the display of the shipping information on the order details page in WooCommerce.

The woocommerce_order_shipping_to_display_shipped_via filter is used to control how the shipped via information is displayed. In this case, the __return_empty_string function is used to return an empty string, effectively hiding the shipped via information from being shown. Also, this function is a valuable tool within the WooCommerce ecosystem that allows you to control the display of shipping information on your order-related pages.

Conclusion

Let us know your feedback on how the code was useful or any other queries in the comments section.

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