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

How to Add Short Descriptions for WooCommerce Shipping Methods Below Each Title?

If you need to add short descriptions to specific shipping methods, this snippet is the perfect solution. It’s ideal for scenarios where certain shipping methods require additional explanation or details.

function ts_add_description_field_to_shipping_method( $fields ) {
    $fields['short_description'] = array(
        'title'       => __( 'Short Description', 'woocommerce' ),
        'type'        => 'textarea',
        'description' => __( 'Add a short description for this shipping method.', 'woocommerce' ),
        'default'     => '',
        'desc_tip'    => true,
    );
    return $fields;
}
foreach ( array( 'free_shipping' ) as $method ) {
    add_filter( 'woocommerce_shipping_instance_form_fields_' . $method, 'ts_add_description_field_to_shipping_method' );
}
function ts_add_description_to_shipping_label( $label, $method ) {
    $shipping_zones = WC_Shipping_Zones::get_zones();
    foreach( $shipping_zones as $zone ) {
        foreach( $zone['shipping_methods'] as $instance_id => $shipping_method ) {
            if( $method->get_method_id() === $shipping_method->id && $method->get_instance_id() === (int)$instance_id ) {
                $short_description = $shipping_method->get_option( 'short_description' );
                if( $short_description ) {
                    $label .= '<div class="shipping-method-description">' . esc_html( $short_description ) . '</div>';
                }
            }
        }
    }
    return $label;
}
add_filter( 'woocommerce_cart_shipping_method_full_label', 'ts_add_description_to_shipping_label', 10, 2 );

Output

The code snippet introduces a new field, ‘Short Description,’ to your WooCommerce shipping methods. This field allows you to input descriptions for shipping method through the admin side.

How to Add Short Descriptions for WooCommerce Shipping Methods Below Each Title? - Tyche Softwares

In another scenario, it retrieves and displays the short description on the cart page. This way, customers can view additional information about each shipping method during the checkout process.

How to Add Short Descriptions for WooCommerce Shipping Methods Below Each Title? - Tyche Softwares

Similarly, you can also display a delivery day range based on shipping country on WooCommerce cart page.

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

Share It:

Subscribe
Notify of
4 Comments
Newest
Oldest
Inline Feedbacks
View all comments
3 months ago

Hello, somehow this code snippet is not working for us.. is it updated to last woocommerce?

Editor
2 months ago
Reply to  Omar

Hi Omar,
We’ve tested the code, and it works fine with the latest versions of WordPress and WooCommerce. Please ensure that you have selected the “Minimum Order Amount” option, as the short description field will only appear when this option is enabled.
You can refer to the screenshot here: https://prnt.sc/Ym451a59va_e. Let us know if you need further assistance!

1 month ago
Reply to  Saranya

Hi,
I have the same problem. The snippet works as far as adding the short description when defining the shipping method, but the description doesn’t appear at checkout.
Is the snippet supposed to go under the functions.php of the theme? That’s where I’ve put it.
Thanks!

Editor
1 month ago
Reply to  KNude

Hi KNude,
Yes, the snippet should be placed in your theme’s functions.php file. The code has been tested and it works fine in the updated version of WooCommerce 9.7.1, displaying the description on both the cart and checkout pages. If it’s not appearing, try switching to a default theme (like Storefront) and disabling other plugins. If the issue persists, please share any other customizations you’ve made related to shipping for better troubleshooting.

4
0
Would love your thoughts, please comment.x
()
x
Privacy Overview

This website uses cookies so that we can provide you with the best user experience possible.

Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.

By using our site, you acknowledge that you have read and understood our Privacy Policy and Terms & Conditions.