The United States Postal Service (or USPS) is integrated in Magento as one of its default shipping method. The USPS is the agency of the U.S offering domestic and international delivery to more than 190 countries, both by land and air. In this tutorial, we will guide you to configure USPS in Magento admin panel.
Get your USPS Web Tools credentials
First of all, having an account on USPS Web Tools is crucial. Kindly create a new one if you haven’t registered:
- Open USPS Web Tools via this URL: https://registration.shippingapis.com/
- Key in all required fields in a registration form as below
- After completion, you will receive your User ID and a URL to the USPS test server.
Configure USPS in Magento 2
In your backend, navigate to Stores > Configuration (under Settings tab) > Shipping Methods (under Sales tab)
Expand the USPS set of options.
- Set Enabled for Checkout to Yes.
- The Gateway URL and Secure Gateway URL are set by default, and you should leave it as it is.
- Name this shipping method by key in the Title field if needed, or you can leave it as default.
- Enter the User ID and Password for your USPS account.
- Choose Mode as:
- Development: if you want to run USPS in a test environment.
- Live: if you want to run USPS in your live site.
- Set Packages Request Type to:
Divide to Equal Weight (one request): Choose this if the goods in packages have approximately equal weight.Use Origin Weight (few requests): Choose this if there are child products among other large goods in packages.
- Choose Container as the packaging type frequently used in your store. You can choose among:
- Variable (if you are not sure what packaging type should be chose, choose this)
- Flat-Rate Box
- Flat-Rate Envelope
- Set the Size as:
- Set Machinable to Yes or No, depending whether your typical package can be processed by a machine or manually.
- Enter the Maximum Package Weight according to your carrier requirements.
- Set Calculate Handling Fee to Fixed or Percent
- Determine Handling Applied to Per Order or Per Package
- Enter the amount of the Handling Fee. Use the decimal format for a percentage.
- Pick options in Allowed Methods list
- Set the Free Method to Yes or None.
- Set Enable Free Shipping Threshold field to Disable or Enable.
- Displayed Error Message: Leave this message as default or write a tailored message
- Set Ship to Applicable Countries to all or specific countries where this shipping method can be used.
- Set Show Method if Not Applicable to
- Yes: Lists all available USPS shipping methods during checkout, including those that don’t apply to the shipment.
- No: Lists only the USPS shipping methods that are applicable to the shipment.
- Set Debug to Yes if you need a log file with activities of USPS shipments.
- In the Sort Order field, determine in which order USPS shipping method appears in the shipping methods list.
- Click Save Config.