Skip to content

Instantly share code, notes, and snippets.

@jorpdesigns
Created July 12, 2021 16:56
Show Gist options
  • Save jorpdesigns/ff46a48ed25dd58644907212b8380c41 to your computer and use it in GitHub Desktop.
Save jorpdesigns/ff46a48ed25dd58644907212b8380c41 to your computer and use it in GitHub Desktop.
Snippet to add description to WooCommerce shipping methods
<?php
add_filter('woocommerce_cart_shipping_method_full_label', 'custom_shipping_method_label', 10, 2);
function custom_shipping_method_label( $label, $method ){
switch ( $method->instance_id ) {
case '7': // Replace with your own shipping method id
$text = '<br /><small>' . __('Add Method Description') . '</small>';
break;
default:
$text = '';
}
return $label . $text;
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment