Show your customers accurate shipping rates automatically with our integration for USPS, the largest delivery network in United States.
Your store must use US Dollars for its currency and the United States, US Virgin Islands or Puerto Rico as the base country. It works with inches (in) and pounds (lbs), but other units can be converted automatically.
USPS calculates quotes worldwide.
DOMESTIC
INTERNATIONAL
First Class
Flat Rate
Priority Mail
Priority Mail Express
Standard Post
Media Mail
Library Mail
First Class International
Global Express Guaranteed (GXG)
Priority Mail International
Priority Mail International Flat Rate
International Postcards
We recommend using this extension in combination with our Stamps.com extension (separate purchase), which creates shipping labels based on real-time rates from USPS.
Other features:
Enable/disable, edit the names of, and add costs to services
Pack items individually or using the built in box packer
USPS Shipping is a premium method that sources shipping rates from the USPS API and works with our Stamps.com extension (separate purchase) to create shipping labels.
It requires your store to use US Dollars as its currency and your server to have SimpleXML installed. The extension primarily works with measurements in Inches (in) and weight in Pounds (lbs), but other units can be converted automatically.
USPS requires a base country of the United States, Puerto Rico or US Virgin Islands and can calculate domestic and international parcel rates.
The API and built-in box packer need your non-virtual products to have weights and dimensions set. More info at: Adding Shipping Dimensions to Products.
Installation
To install this extension, you can follow these instructions, or use the below steps to do a manual installation.
Download the extension from your dashboard
Upload the plugin folder to your /wp-content/plugins/ directory
Activate ‘WooCommerce USPS’ from the Plugins menu within WordPress
For support and one-click updates, you also need to install our WooCommerce Helper plugin.
USPS User ID – You can use our USPS User ID (this is set automatically) or get your own by signing up for a Webtools account on USPS.com.
Debug Mode – Enable debug mode to show debugging info on your cart/checkout. This information is shown to ALL users, so you can test when logged out.
Setup and Configuration
Go to: WooCommerce > Settings > Shipping.
Select the Shipping Zone you want to add the method to, and click the Add shipping method + button on the right
Select USPS from the dropdown and press Add shipping method:
Configure the settings:
Method Title – Name the shipping method. This is visible to customers.
Offer Rates – Choose the options you want to give customers.
Fallback – Enter a fallback shipping cost (optional), if no rates are returned from the API. This allows the customer to check out if USPS does not return matching rates. When using this option, do not use a dollar sign, just enter the amount (ex: 12.50).
Flat Rates
Flat Rate Boxes and Envelopes – Enable this option to offer shipping using USPS Flat Rate services. Items are packed into the boxes/envelopes, and the customer is offered a single rate.
Express Flat Rate Title – Give a custom name to the express flat rate.
Priority Flat Rate Title – Give a custom name to the priority flat rate.
Additional Fee – Enter a fee per box excluding tax, such as an amount (2.50) or a percentage (5%). Or leave blank to disable.
API Rates – Check to enable non-flat rates using the USPS API. Default is all services available; or choose what to offer from the available shipping services listed below. You can adjust:
Enable API Rates – This enables non-flat rate services.
Origin Postcode – Postcode from where you ship. It is sent to the USPS API.
Shipping Rates – Retail rates are standard costs, Commercial rates are discounted.
Parcel Packing Method – See below for more detailed explanation.
Note: The USPS shipping extension is a calculator for all products in the cart, and does not exclude products based on shipping classes. To exclude products from using the USPS shipping method, try the WooCommerce Conditional Shipping and Payments extension.
Available Shipping Services
These services are included with the USPS Shipping extension:
Domestic
First-Class Mail® Parcel
First-Class Mail® Large Envelope
First-Class Mail® Postcards
First-Class Mail® Stamped Letter
First-Class™ Postcard Stamped
First-Class™ Large Postcards
First-Class™ Keys and IDs
First-Class™ Package Service
First-Class Mail® Metered Letter
First-Class™ Package Service Hold For Pickup
Priority Mail Express™ Hold for Pickup
Priority Mail Express™
Priority Mail Express™ Sunday/Holiday
Retail Ground™
Media Mail®
Library Mail
Priority Mail®
Priority Mail® Keys and IDs
Priority Mail® Hold For Pickup
Priority Mail® Regional Rate Box A
Priority Mail® Regional Rate Box B
International
Priority Mail Express International™
Priority Mail International®
Global Express Guaranteed® (GXG)
Global Express Guaranteed® Document
Global Express Guaranteed® Non-Document Rectangular
Global Express Guaranteed® Non-Document Non-Rectangular
USPS GXG™ Envelope
First Class Mail® International Letters
First Class Mail® International Large Envelope
First Class Package International Service™
International Postcards
Flat Rate Shipping Options
Priority Mail Flat Rate™ – Envelopes (Legal, Letter, Gift Card, Padded, Small, Window) and Boxes (Small, Medium 1 and 2, Large, APO/DPO/FPO Large, Large Board Game, Prepaid Forever® Packaging)
Priority Mail Express Flat Rate™ – Envelopes (Envelope, Legal, Padded) and Boxes (Top-Loading, Side-Loading)
Priority Mail International Flat Rate® – Envelopes (Legal, Letter, Gift Card, Padded, Small, Window) and Boxes (Small, Medium 1 and 2, Large, APO/DPO/FPO Large, Large Board Game)
To enable any of these options:
Select the Standard Services option to ‘Enable Standard Services from the API’.
You also have the option to rename the service and include a negative/positive price adjustment by the default currency or a percentage.
Price adjustments ($) – Add a flat adjustment to the USPS service.
Price adjustments (%) – Add a percentage adjustment to the USPS service.
Flat Rate Services
If enabled, the flat rate box option creates a single quote based on USPS Flat Rate Services. To do this, the system uses the box packer (explained below) applying USPS box dimensions. Packed boxes are then combined to offer a single rate (named by your ‘method title’).
It is important to note that Flat Rate Shipping prices come directly from USPS, and you cannot add or modify pricing for this option.
Parcel Packing Method
There are three packing methods with USPS, and each affects the parcels you send to the API.
Per-Item
Each item in your cart (non-virtual) is sent to the USPS API. Quotes for all items are combined to calculate the final cost.
Pack into boxes
Items are packed into pre-defined boxes and sent to the API. We recommend this option. See Box Packing below for more information.
Weight based
Regular sized items (< 12 inches) are grouped and quoted for weights only. Large items are quoted individually.
Box Packing
The box packer included with this shipping method lets you group items into packages for which you define height, width, length, weight and max-weight. Packing is mainly volume based but also considers item size.
The box packer is volume based. This provides good results in most cases but are never be as accurate as a real person packing a box (see BIN Packing Problem). Therefore, it is important to understand that packing results are as accurate as possible, and any anomalies should be acceptable.
Setting up box sizes
When using the ‘Recommended: Pack into boxes with weights and dimensions’ Parcel Packing Method, the Box Sizes table will appear. Click ‘Add Box’ to set up dimensions for your packages.
Name: This allows you to name your custom packages. This name will show in the Debug if that package is used.
L (in), W (in), H (in): The first set of dimensions are the outer dimensions of the package. These are the dimensions passed to the API. If you are working with a flat rate box via the API (i.e., Regional Boxes), use the API’s ‘inner dimensions’ for your box’s outer dimensions. Your box must ‘fit’ inside.
Inner L (in), Inner W (in), Inner H (in): The second set of dimensions are for the inner dimensions of the packaging. This should be the outer dimensions minus the thickness of the package walls. These dimensions are used for packing and items must fit within them (they cannot be the same size as the products, allow for a little extra room).
Weight of Box (lbs): This is the weight of the empty box by itself. This weight is added to the total weight of the contents.
Max Weight (lbs): This is the maximum weight your box can hold. This includes the weight of the box and the contents.
Letter: This checkbox determines whether your package is a letter (envelope) or a box.
How the calculation works
The box packer:
Finds boxes that fit items being packed (uses H x W x D).
Packs all items into boxes (using volume).
Uses the largest box fitting 100% of items *or* uses the highest % packed box, and then passes unpacked items back (and repeats the process)
Packs unpackable items alone, using item dimensions.
Returns all packed boxes.
Media Mail®
To enable Media Mail®, you must select the ‘Enable Standard Services from the API’ option. You then have two options: a) You can do nothing, which allows any item to use Media Mail®; or b) if only some of your products are eligible for Media Mail®, you need to give each product a shipping class and restrict Media Mail® to use only that class or classes.
After setting up shipping classes, you can restrict settings in your Shipping Zone USPS rate:
Customer Usage
Customers can get quotes based on the address entered from two places:
Cart page – by using the shipping calculator
Checkout page – by filling in shipping and billing forms
Rates can be selected by customers.
Troubleshooting
No rates returned/no rates available
Enable debug mode to see debugging info on the cart page. This often reveal the issue.
Check that products have sizes and weights set – without this, the calculation cannot be performed.
Go to: WooCommerce > Settings > General and check that your store’s base country is the United States and US Dollars is the currency.
Check that the plugin is linked to USPS API. It uses wp_remote_post, which makes use of fsockopen/CURL.
If you need help with adding weights/dimensions, see:
“UserName exceeds maximum length of 12 characters” error message
If you receive this error message when the debug mode is enabled, you need to use a shorter username.
Customize
Note: This is a Developer level section. If you are unfamiliar with code and resolving potential conflicts, select a WooExpert or Developer for assistance. We are unable to provide support for customizations under our Support Policy.
Filter Flat Rate Services
To change the USPS package to envelope so dimensions are fixed, add this to your theme’s functions.php file:
/**
* USPS 4.0 introduced the ability for envelopes to be flexible you can disable this with this function
* Simply set the type to 'envelope' instead of 'package' for any of the flat rate services that USPS lists as envelopes
To remove all the USPS Priority Flat Rate envelopes, leaving only the Small, Medium, and Large Flat Rate boxes, add this to your theme’s functions.php file:
/**
* Remove USPS Flat rate envelopes from the available options
* Once added the customer will not see any rates for envelopes
* Only Small, Medium, and Large Flat Rate boxes will be used
The codes for each flat rate box can be found below:
Priority Mail Express Priority Mail Express Flat Rate Envelope: d13 Priority Mail Express Legal Flat Rate Envelope: d30 Priority Mail Express Padded Flat Rate Envelope: d63
Priority Mail Priority Mail Flat Rate Envelope: d16 Priority Mail Flat Rate Medium Box (Side Loading): d17 Priority Mail Flat Rate Medium Box (Top Loading): d17b Priority Mail Flat Rate Large Box: d22 Priority Mail Flat Rate Large Box (Board Game): d22a Priority Mail Flat Rate Small Box: d28 Priority Mail Padded Flat Rate Envelope: d29 Priority Mail Gift Card Flat Rate Envelope: d38 Priority Mail Window Flat Rate Envelope: d40 Priority Mail Small Flat Rate Envelope: d42 Priority Mail Legal Flat Rate Envelope: d44
International Priority Mail Express Priority Mail Express Flat Rate Envelope: i13 Priority Mail Express Legal Flat Rate Envelope: i30 Priority Mail Express Padded Flat Rate Envelope: i63
International Priority Mail Priority Mail Flat Rate Envelope: i8 Priority Mail Padded Flat Rate Envelope: i29 Priority Mail Flat Rate Small Box: i16 Priority Mail Flat Rate Medium Box (Side Loading): i9 Priority Mail Flat Rate Medium Box (Top Loading): i9b Priority Mail Flat Rate Large Box (Top Loading): i11
Exclude a country from USPS rates
If you wish to exclude a country from receiving USPS rates, the easiest way is to use Shipping Zones (WooCommerce 2.6+). However if you wish, you can use the snippet below. Change US to the country code you’d like to exclude:
0 Comments:
Post a Comment
Note: only a member of this blog may post a comment.
Subscribe to Post Comments [Atom]
<< Home