Created
October 12, 2015 19:27
-
-
Save bekarice/5e65bd30b62b13e2c1f2 to your computer and use it in GitHub Desktop.
WooCommerce: Display Shipping Estimates with methods on cart / checkout
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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