Instantly share code, notes, and snippets.

Embed
What would you like to do?
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