Skip to content

Instantly share code, notes, and snippets.

@xadapter
Last active September 19, 2019 06:47
Show Gist options
  • Save xadapter/cb7a9a83b11d953077c57e4bcc8fa072 to your computer and use it in GitHub Desktop.
Save xadapter/cb7a9a83b11d953077c57e4bcc8fa072 to your computer and use it in GitHub Desktop.
Snippet to change UPS credentials in UPS Access-point Locator Request using WooCommerce UPS Shipping Plugin with Print Label by PluginHive - https://www.pluginhive.com/product/woocommerce-ups-shipping-plugin-with-print-label/
/**
* Snippet to change UPS credentials in UPS Accesspoint Locator Request. Requires UPS plugin version - 3.10.2.
* Created at : 22 Aug 2018
* Updated at : 22 Aug 2018
* PluginHive Plugins : https://www.pluginhive.com/plugins/
* Gist Link : https://gist.github.com/xadapter/cb7a9a83b11d953077c57e4bcc8fa072
*/
if( ! function_exists('ph_change_ups_accesspoint_credentials') ){
function ph_change_ups_accesspoint_credentials( $xml_request, $ups_settings ) {
$new_ups_user_id = 'ups_user_id'; // Replace ups_user_id with your UPS User Id
$new_ups_access_key = 'ups_access_key'; // Replace ups_access_key with your UPS Access Key
$new_ups_password = 'ups_password'; // Replace ups_password with your UPS Password
$xml_request = str_replace( array( $ups_settings['access_key'], $ups_settings['user_id'], $ups_settings['password'] ), array( $new_ups_access_key, $new_ups_user_id, $new_ups_password ), $xml_request );
return $xml_request;
}
add_filter( 'ph_ups_access_point_xml_request', 'ph_change_ups_accesspoint_credentials', 10, 2 );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment