Created
April 13, 2016 13:49
-
-
Save WooForce/824b8347fba63cb28cb160305eca774c to your computer and use it in GitHub Desktop.
FedEx - Change product name and description while label printing.
This file contains hidden or 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
add_filter('wf_fedex_request','wf_fedex_label_custom_product_name_request_callback', 10, 2 ); | |
function wf_fedex_label_custom_product_name_request_callback($request, $order){ | |
$product_name = 'Book'; //Type here a product name it'll come as name of all products, Don't leave this blank or white space | |
$product_description = 'Book'; //Description, This will come for all products, Don't leave this blank or white space | |
$commodities = isset( $request['RequestedShipment']['CustomsClearanceDetail']['Commodities'] ) ? $request['RequestedShipment']['CustomsClearanceDetail']['Commodities'] : ''; | |
if($commodities != '' ){ | |
foreach ($commodities as $key => $commodity) { | |
$request['RequestedShipment']['CustomsClearanceDetail']['Commodities'][$key]['Name'] = sanitize_title( $product_name ); | |
$request['RequestedShipment']['CustomsClearanceDetail']['Commodities'][$key]['Description'] = sanitize_title( $product_description ); | |
} | |
} | |
return $request; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment