Skip to content

Instantly share code, notes, and snippets.

@renjith-ph
Created December 4, 2018 10:28
Show Gist options
  • Save renjith-ph/f770a18689e64c3efd48573ed0f228f2 to your computer and use it in GitHub Desktop.
Save renjith-ph/f770a18689e64c3efd48573ed0f228f2 to your computer and use it in GitHub Desktop.
Snippet to change fedex shipping date if it is saturday or sunday. PluginHive Plugins : https://www.pluginhive.com/plugins/
**
* Snippet to change fedex shipping date if it is saturday or sunday.
* Created at : 21 Nov 2018
* Updated on : 22 Nov 2018
* PluginHive Plugins : https://www.pluginhive.com/plugins/
*/
add_filter( 'wf_fedex_request', 'wf_fedex_request', 10, 3 );
if( ! function_exists('wf_fedex_request') ) {
function wf_fedex_request( $request, $order, $parcel ) {
if(date('l',strtotime($request['RequestedShipment']['ShipTimestamp']))=='Saturday')
{
$date=date('c',strtotime('+2 days',strtotime($request['RequestedShipment']['ShipTimestamp']))); //adding +2 days if it is saturday.
$request['RequestedShipment']['ShipTimestamp']=$date;
}
elseif (date('l',strtotime($request['RequestedShipment']['ShipTimestamp']))=='Sunday') {
$date=date('c',strtotime('+1 days',strtotime($request['RequestedShipment']['ShipTimestamp']))); ////adding +1 days if it is sunday.
$request['RequestedShipment']['ShipTimestamp']=$date;
}
return $request;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment