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? 1 How to Add Short Descriptions for WooCommerce Shipping Methods Below Each Title? - Tyche Softwares](https://media.tychesoftwares.com/wp-content/uploads/Short-Description-Field-in-the-Shipping-Methods-Table-1024x384.png)
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? 2 How to Add Short Descriptions for WooCommerce Shipping Methods Below Each Title? - Tyche Softwares](https://media.tychesoftwares.com/wp-content/uploads/Short-Description-field-details-shown-on-the-WooCommerce-Cart.png)
Similarly, you can also display a delivery day range based on shipping country on WooCommerce cart page.