Skip to content

Instantly share code, notes, and snippets.

@bekarice
Created October 12, 2015 19:27
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bekarice/5e65bd30b62b13e2c1f2 to your computer and use it in GitHub Desktop.
Save bekarice/5e65bd30b62b13e2c1f2 to your computer and use it in GitHub Desktop.
WooCommerce: Display Shipping Estimates with methods on cart / checkout
<?php
/**
* only copy opening php tag if needed
* Displays shipping estimates for WC shipping rates
*/
function sv_shipping_method_estimate_label( $label, $method ) {
$label .= '<br /><small>';
switch ( $method->method_id ) {
case 'flat_rate':
$label .= 'Est delivery: 2-4 days';
break;
case 'free_shipping':
$label .= 'Est delivery: 4-7 days';
break;
case 'international_delivery':
$label .= 'Est delivery: 7-10 days';
break;
default:
$label .= 'Est delivery: 3-5 days';
}
$label .= '</small>';
return $label;
}
add_filter( 'woocommerce_cart_shipping_method_full_label', 'sv_shipping_method_estimate_label', 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment