Last active
January 2, 2019 13:41
-
-
Save renjith-ph/e5de5579ce0750682592e3ac09089e8b to your computer and use it in GitHub Desktop.
Snippet to change product description in commercial invoice.
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
/** | |
* Snippet to change product description in commercial invoice. | |
* Created at : 28 Dec 2018 | |
* PluginHive Plugins : https://www.pluginhive.com/plugins/ | |
*/ | |
add_filter( 'ph_fedex_commodities','ph_fedex_commodities_description_customization',10,3); | |
function ph_fedex_commodities_description_customization($commodoties,$request,$fedex_packages) { | |
$products=array( | |
array( 'ids'=>array('199','122','789'), | |
'description'=>"put something to showin description" | |
), | |
array( 'ids'=>array('1993','162','489'), | |
'description'=>"put something to showin description" | |
), | |
); | |
foreach ($commodoties as $product_id => $product_details) { | |
foreach ($products as $key => $value) { | |
if(in_array($product_id, $value['ids'])) | |
{ | |
$commodoties[$product_id]['Description']=html_entity_decode( $value['description']); | |
} | |
} | |
} | |
return $commodoties; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment