Getting live shipping quotes with USPS

If you want to give users the exact shipping cost and not have to figure out how to do it with Flat Rate Shipping, you can get rates directly from USPS. That way, you can't estimate the costs wrong and lose money on shipping. It takes a bit of extra work to set it up, but the results make it very easy for users to select the exact shipping method they want and there's no confusion for the admin.

You could also get rates from UPS or FedEx and the process is very similar. The reason I choose to use USPS is because it's slightly easier to set up. With USPS, WooThemes has been able to include credentials in the plugin, which means you have one less account to set up.

Getting ready

Make sure shipping is enabled on your site. See the Setting a minimum order amount to unlock free shipping recipe in this chapter to see how this is done. You'll need to have weights and dimensions for all of your products. If they don't have both weight and dimensions set, you won't get any results. You'll also need the WooCommerce USPS plugin (available on WooThemes.com) installed and activated on your site.

How to do it…

In order to get live shipping quotes with USPS, go through the following steps:

  1. From the WordPress admin, go to WooCommerce | Settings | Shipping.
  2. Click on USPS.
  3. Enable the shipping method by checking the Enable this shipping method setting.
  4. Enter your zip code in the Origin Postcode field.
  5. Make sure the Flat Rate Boxes & envelopes dropdown is set to Yes – Enable flat rate services:
    How to do it…
  6. Click on Save changes.

At this point, if you go to the frontend of your site and add a few products to your cart, you should see some quotes from USPS based on how many products you have and how many can fit into each flat rate box. Let's take a look at the following screenshot that displays some details about Cart Totals:

How to do it…

Note

Naturally, you may see different rates from what's shown in the preceding screenshot. It all depends on the size, dimensions, weight, and quantity of products you have in your cart.

Getting this far enables you to use the flat rate boxes from USPS, which is convenient for many businesses. However, some businesses want or need to have custom box sizes. You can enter your own box sizes and USPS will give you a custom quote for using your custom boxes. For entering custom box sizes, you need to perform following steps:

  1. Under API Rates, check the Enable Standard Services from the API setting. Some new fields will appear.
  2. For the Parcel Packing Method setting, select Recommended: Pack into boxes with weights and dimensions.
  3. Now add your custom box sizes. You can add as many as you need by clicking on the Add Box button as shown in the following screenshot:
    How to do it…
  4. Press Save changes to make sure everything is saved.

On the frontend, you should now see different rates. Have a look at the following demonstrative screenshot:

How to do it…

Note

If you're having trouble getting rates, make sure that all of your products have weights and dimensions set on the Edit Product page on the Shipping tab of the Product Data panel. Then make sure they can fit into at least one box. Then make sure you have a destination set on the Cart page. You can set a destination by clicking on the Calculate Shipping link.

How it works…

The USPS plugin includes a box packer. This box packer will automatically figure out how many items can fit in a box and then send the list of boxes to USPS. USPS does all of the rate calculation on their side and returns the results to WooCommerce, which are then displayed for the customer.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset