Displaying shipping rates on the single product page in WooCommerce can significantly improve the shopping experience by providing transparency and setting customer expectations early in the purchase process. This guide will show you how to achieve this without relying on plugins, ensuring better performance and fewer compatibility issues. We’ll also include use case examples to illustrate the benefits of this approach.
Why Show Shipping Rates on the Product Page?
- Transparency: Customers appreciate knowing the total cost, including shipping, before adding products to their cart.
- Reduced Cart Abandonment: Clear shipping information upfront can reduce cart abandonment rates caused by unexpected shipping costs at checkout.
- Improved Customer Experience: Providing shipping details early in the shopping process can enhance the overall customer experience, leading to higher satisfaction and potentially increased sales.
Step-by-Step Guide
Step 1: Add the Code to Your Child Theme’s functions.php
First, ensure you have a child theme activated to prevent any changes from being lost during theme updates. If you don’t have a child theme, you can create one using our free child theme generator.
Add the following code to your child theme’s functions.php file:
/*
* Snippet: How to Show Shipping Rates on the Single Product Page in WooCommerce – 2026
* Author: John Cook
* URL: https://wcsuccessacademy.com/?p=1385
* Tested with WooCommerce 10.7.0
* "Display shipping rates on the single product page"
*/
function wcsuccess_display_shipping_rates() {
if ( ! is_product() ) {
return;
}
$product_id = get_the_ID();
$product = wc_get_product( $product_id );
$shipping_class_id = $product->get_shipping_class_id();
$packages = array();
if ( WC()->cart ) {
$packages = WC()->cart->get_shipping_packages();
}
$packages[0]['contents'][ $product_id ] = array(
'product_id' => $product_id,
'quantity' => 1,
'data' => $product,
'line_total' => $product->get_price(),
'line_tax' => 0,
);
$packages[0]['contents_cost'] = $product->get_price();
$shipping_methods = WC()->shipping->calculate_shipping( $packages );
if ( $shipping_methods ) {
echo '<div class="product-shipping-rates"><h2>Shipping Rates</h2><ul>';
foreach ( $shipping_methods as $method ) {
echo '<li>' . esc_html( $method->label ) . ': ' . wc_price( $method->cost ) . '</li>';
}
echo '</ul></div>';
}
}
add_action( 'woocommerce_single_product_summary', 'wcsuccess_display_shipping_rates', 25 );
Step 2: Style the Shipping Rates Display
You can style the shipping rates display by adding custom CSS to your theme. Here’s an example:
.product-shipping-rates {
margin-top: 20px;
padding: 10px;
background-color: #f9f9f9;
border: 1px solid #ddd;
}
.product-shipping-rates h2 {
font-size: 1.2em;
margin-bottom: 10px;
}
.product-shipping-rates ul {
list-style: none;
padding: 0;
}
.product-shipping-rates ul li {
margin-bottom: 5px;
}
Add this CSS to your theme’s style.css file or via the WordPress Customiser.
Use Case Examples
Example 1: Encouraging International Purchases
If your store ships internationally, displaying shipping rates on the product page can help international customers decide if the total cost, including shipping, fits their budget. This transparency can encourage more international purchases and reduce the likelihood of cart abandonment due to unexpected shipping costs at checkout.
Example 2: Promoting Free Shipping Thresholds
By showing shipping rates on the product page, you can also highlight any free shipping thresholds. For example, you could modify the code to display a message like “Add $X more to your cart to qualify for free shipping!” This can encourage customers to add more items to their cart to reach the free shipping threshold, increasing your average order value.
Example 3: Enhancing Mobile Shopping Experience
Mobile shoppers often look for quick and clear information. Displaying shipping rates directly on the product page ensures they can see all the necessary details without having to navigate through multiple pages, providing a smoother and more efficient shopping experience on mobile devices.
Conclusion
Adding shipping rates to the single product page in WooCommerce without a plugin is a straightforward process that can enhance transparency, reduce cart abandonment, and improve the overall customer experience. By following the steps outlined above, you can easily integrate this feature into your WooCommerce store and enjoy the benefits of happier, more informed customers.
Remember to test your changes thoroughly to ensure they work correctly with your theme and other customisations. If you need a child theme, don’t forget to use our free child theme generator.
By implementing this feature, you’re taking another step towards creating a more user-friendly and efficient WooCommerce store. Happy selling!
I have been working with WordPress and WooCommerce since 2012 and have developed a deep knowledge of the content management system. Since 2012, I have developed several plugins and designed dozens of websites utilising different frameworks, CMS’s and programming languages. I am proficient in PHP, Python, Java, C, C++, R and JavaScript with limited experience in Go, Kotlin and Swift.
Educationally, I have a Master’s degree in cyber security a Bachelor’s (Hons, First Class) in Applied Research and a Graduate Certificate in Data Science. I’m currently undertaking PhD studies investigating IoT cybersecurity. I recently graduated with First Class Honours and Masters of Information Technology, receiving the Executive Dean’s Award for studies undertaken in the 2021 and 2022 academic years. I have worked in the information technology industry for the past 11 years primarily as a software/web developer specific to design, optimisation, network management and security. My research interests are in the areas of Internet of Things (IoT), 5G and Beyond Networks, information security for wireless networks and software development.
Stay In Touch

