Skip to content

Instantly share code, notes, and snippets.

@dangoodman
Created March 16, 2017 14:58
Show Gist options
  • Save dangoodman/00e2699474631553c27cb62e82d71a13 to your computer and use it in GitHub Desktop.
Save dangoodman/00e2699474631553c27cb62e82d71a13 to your computer and use it in GitHub Desktop.
WooCommerce: Hide shipping option labels
<?php
// Paste everything below this line to your theme's functions.php file.
// Hide shipping option labels.
// Example:
// — Regular Shipping: $20 => $20
// — Express Shipping: $30 => $30
// — Free Shipping => Free
add_filter('woocommerce_cart_shipping_method_full_label', function($label) {
@list(, $price) = explode(':', $label);
return isset($price) ? ltrim($price) : 'Free';
}, 2);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment