What can we help you with?
WooCommerce EasyPost – Use different FedEx, UPS, and USPS accounts for Domestic and International Shipping (Code Snippet)
Elizabeth is our customer who uses our ELEX EasyPost (FedEx, UPS & USPS) Shipping & Label Printing Plugin for WooCommerce. She has an EasyPost account with two different EasyPost account IDs for FedEx. She wants to use one of them for domestic shipping and the other of international shipping.
To help her out with this requirement, we provided her with a code snippet that enabled her to access domestic and international rates from two different accounts respectively.
Note: If you are using UPS or USPS shipping service with our ELEX EasyPost Shipping Plugin, you can follow the same method. The only difference is the change in credentials.
Prerequisites
Before the code snippet is added to the site, there are a few prerequisites to be followed. You need to have two different EasyPost account IDs for FedEx domestic and international shipping respectively.
Here’s what you need to do.
- Log into your EasyPost account and go to your dashboard section.
- Click on your account email address to reveal further settings, and click Carrier Accounts.
- Next, in the Carrier Accounts section, select two FedEx carriers. Click on Edit button and provide respective FedEx credentials for both the accounts.
- Notice the Account IDs for both the instances of the FedEx carriers. These are unique IDs generated by EasyPost for each selected shipping carrier.
- You need these two account IDs to be used in the code snippet.
Code snippet to use different FedEx, UPS, and USPS accounts for Domestic and International Shipping
Add the below code snippet in your Theme Functions (functions.php) file of your activated website theme.
add_filter('elex_easypost_two_different_carrier_account','elex_easypost_carrier_account_details'); function elex_easypost_carrier_account_details() { // Use EasyPost carrier account ID's.. return array( 'FedEx'=>array('domestic'=>'xxxxxxxxxx','international'=>'yyyyyyyyyy'), 'USPS'=>array('domestic'=>'xxxxxxxxxx','international'=>'yyyyyyyyyy'), 'UPS'=>array('domestic'=>'xxxxxxxxxx','international'=>'yyyyyyyyyy') ); }
Replace the dummy values xxxxxxxxxx and yyyyyyyyyy with respective FedEx, UPS, and/or USPS domestic and international account IDs from EasyPost.
In this way, you can use different FedEx, UPS, and USPS accounts for Domestic and International Shipping, with our
ELEX EasyPost (FedEx, UPS & USPS) Shipping & Label Printing Plugin for WooCommerce.
To explore more details about the plugins, go check out ELEX EasyPost Shipping Method Plugin for WooCommerce.
Read the article for setting up EasyPost to understand the plugin, in detail. Or check out the product documentation section for more related articles.
You can also check out other WooCommerce and WordPress plugins in ELEX.