This is tutorial #17 in the Drupal Commerce tutorial series. In the previous article, we charged a specific shipping rate based on the buyer's location.
n this article, I am going to provide you with the instructions required to set up FedEx shipping for your Drupal store. You will learn how to configure your Drupal store to access FedEx’s testing and production environment. The screenshot below shows a step in the configuration process that will be seen later in the article:
The first step is to create an account for your business by going to www.fedex.com:
Specify the primary location from where you intend to do business:
Click “Register Now”:
You will be directed to the My FedEX REWARDS page. Click “CONTINUE” if you wish to opt for it. I am clicking “No thank you. I do not wish to join My FedEx Rewards” to continue with this tutorial:
Fill in your registration details. Provide your name, address and the password you would like to use along with this shipping account. Make sure you opt to create a FedEx account. Click “Continue”:
In the next screen, you will have to provide the credit card information you want associated with this account. At the bottom of the screen, you will come across some routine shipping-related questions that have dropdown answers:
Save your profile. After you are done with the registration, go to “fedex.com/developer” and click “FedEx Office Web Services”. This is where you can access the credentials required to test and use FedEx’s web services on your site.
FedEx provides you with 2 environments to experience its shipping functionality. You could experience FedEx’s web services in testing or production environments within Drupal.
Click “Move to development” under Develop and Test if you want to work with the testing environment.
Click “Move to production” under Move to production if you want to work with the production environment.
You will have to then perform the following steps:
- Based on your choice, you will have to click either "Obtain Production Key" or "Obtain Developer Test Key" in the resulting page.
- A License Agreement is then displayed. Tick the boxes and click "I Accept".
- The final page will feature the following values:
- Developer Test Key
- Test Account Number
- Test Meter Number
Save these details. You will also be sent an email with these values.
Let’s now configure the Drupal store to ensure that integration with FedEx is done in the right manner.
Download and unzip the following modules:
- Physical Fields (https://www.drupal.org/project/physical): This module is essential to help Drupal Commerce feature weight-related fields such as kg., pounds, etc.
- Commerce Physical Product (https://www.drupal.org/project/commerce_physical): This module allows you to create custom product types that can contain weight-related fields for your products.
- Commerce FedEx (https://www.drupal.org/project/commerce_fedex): This module allows you to extend FedEx’s functionality.
Let’s get started. Click “Modules”:
Search for “Physical Fields” and enable it. Click “Save configuration”:
Search for “Physical Product” and enable it. Click “Save configuration”:
Search for “FedEx” and enable it. Click “Save configuration”:
Let’s configure FedEx settings. Click “Store”:
You are now on the “SHIPPING SERVICES” page for FedEx. Click “SHIPPING METHODS” on the top-right corner:
Click “Edit” in the new page:
The new page has a lot of fields that need to be filled.
The first section is “FEDEX WEB AUTHENTICATION”. Select “Testing” if you want to work with FedEx’s testing environment first. Fill in the following details received in your email:
- FedEx Key
- FedEx Password
- FedEx Account Number
- FedEx Meter Number
Select “Production” if you want to use FedEx’s production environment. Note that testing credentials cannot be used to access the production environment:
Under “SHIP FROM ADDRESS”, provide your primary shipping address:
You should then select the kind of FedEx shipping services you want enabled for your site:
You should then provide details about kind of default packaging (whether custom or FedEx) and package sizes:
And finally, choose your pricing preference, shipping destination preference (ideally residential) and dropoff/pickup preferences. Click “Save configuration”:
You have now performed a basic FedEx configuration for your Drupal site. You can customize your site’s FedEx capabilities further by adding conditions and rules of your choice.