Skip to content

Instantly share code, notes, and snippets.

@dangoodman
Created May 26, 2019 11:10
Show Gist options
  • Save dangoodman/515a3b9e83974af85a26340aa4137a40 to your computer and use it in GitHub Desktop.
Save dangoodman/515a3b9e83974af85a26340aa4137a40 to your computer and use it in GitHub Desktop.
WooCommerce: replace default shipping option title
<?php
// Paste everything below this line to your child-theme's functions.php file.
// Renames any shipping option titled exactly 'Weight Based Shipping' to 'Shipping'.
add_filter('woocommerce_shipping_method_add_rate_args', function($rateArgs) {
if (isset($rateArgs['label']) && $rateArgs['label'] === 'Weight Based Shipping') {
$rateArgs['label'] = 'Shipping';
}
return $rateArgs;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment