Skip to content

Instantly share code, notes, and snippets.

@xadapter
Forked from Nishadup/function.php
Last active March 12, 2020 10:10
Show Gist options
  • Save xadapter/ea9d60702a5ad8a1f60b86758c28143f to your computer and use it in GitHub Desktop.
Save xadapter/ea9d60702a5ad8a1f60b86758c28143f to your computer and use it in GitHub Desktop.
Snippet to change the estimated delivery time format on the cart or checkout page. WooCommerce FedEx Shipping Plugin: https://www.pluginhive.com/product/woocommerce-fedex-shipping-plugin-with-print-label/
add_filter( 'wf_fedex_estimated_delivery', 'wf_update_delivery_time', 15, 2 );
function wf_update_delivery_time($label, $est_delivery){
$date = explode( '-', $est_delivery['fedex_delivery_time'] );
if( sizeof($date) < 2 ){
return $label;
}
$d = $date[0];
$m = $date[1];
$y = '20'.$date[2];
$delivery_time = date("l, F jS Y", strtotime($y."-".$m."-".$d)); //(Eg: Tuesday, September 13th 2017).
return "<br /><small>Est delivery: $delivery_time</small>";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment