Canada Post

Canada Post is a premium shipping method that allows you get shipping rates from Canada Post’s API. It requires that your store use Canadian Dollars as its currency and your server has SimpleXML installed. The extension primarily works with cm and kg, but other units can be converted automatically.

Canada Post handles both domestic and international parcels.

The API, and the built in box-packer, require that your non-virtual products have weights and dimensions set. See here if you need to know how to do this.

Installation ↑ Back to Top

  1. Upload the plugin folder to the ‘/wp-content/plugins/’ directory.
  2. Activate the plugin through the ‘Plugins’ menu in WordPress.
  3. Thats it – you can now configure the plugin.

Getting Started ↑ Back to Top

We recommend you use pretty permalinks before connecting to Canada Post, this is to avoid an error caused by Canada Post. You can read more about permalinks here, please choose any option except default

The first thing to do when setting up Canada Post is to connect your Canada Post account. We’ve made this process simple – after installation you’ll see a notice at the top of the admin screen asking you to connect:

The connect prompt

The connect prompt

Click the register/connect button to be taken to Canada Post’s website – there you just need to login (or register if you are not yet a user) and allow WOOTHEMES to get quotes from the API on your behalf. When setting up your account on the Canada Post website, you may be asked to enter a credit card for any future automatic transactions that may occur (monthly fees, transaction fees, etc.). You can change it or update it later when you sign in to your My Business Profile on the Canada Post site dashboard.

Please note: The credit card is required by Canada Post, not WooThemes. We do not see your card information, nor do we store it on our site.

Once you’ve done this, you’ll be sent back to your admin panel and you can then configure the plugin. If you ever want to disconnect your account, you can do so at the top of the settings page:

After connecting your account

After connecting your account

Configuration ↑ Back to Top

You configure the plugin through WooCommerce > Settings > Shipping Methods > Canada Post.

  1. Enable/Disable – Choose whether to enable the shipping method of not.
  2. Method Title – Name the shipping method. This will be visibile by customers.
  3. Origin PostcodeThis should be set to the postcode from which you will ship. It is sent to the Canada Post API.
  4. Method Availability –  This setting lets you narrow down the countries which can get quotes. Leave set to All Countries to have it available for all customers.
  5. Debug Mode – If you enable this, API requests and responses will be shown on the cart and checkout pages. Useful when debugging rates.
  6. Quote Type – Commercial uses rates (with discounts) from your account and is also used for VentureOne members. Select ‘counter’ to get rates you’d get over the counter in person.
  7. Rate Cost – Determines which rate is used. “Base” is the base rate cost, “due” is the cost after taxes have been applied.
  8. Lettermail – Choose to enable standard and registered lettermail rates. These rates don’t use the API (as Lettermail isn’t part of Canada Post API) and instead are calculated using box packing and hardcoded prices.
  9. Additional Options – Choose additional options for your parcels.
  10. Delivery Time – If you enable this, an estimation of delivery time (in days) will be shown beside the rates. This info is from the API.
  11. Parcel Packing Method – See below.
  12. Offer Rates – Choose to return all rates (user will get the choice) or just return a single rate.
  13. Services – Here you can rename, and re-order, Canada Post shipping rates and add price adjustments as a percentage or by dollar amount. These adjustments can be either positive or negative, should you want to apply discounts to shipping.


Parcel Packing Methods ↑ Back to Top

There are 3 packing methods with Canada Post; each affects the parcels you send to the API.


Each item in your cart (non virtual) will be sent to the Canada Post API. Quotes for all items will be combined for the final cost.

Weight Based

The cart will be split into 30kg packages, and each package sent to the API. No dimensions will be sent, only the weight.

Pack into boxes

Items will be packed into pre-defined boxes and sent to the API. We recommend this option. See box-packing below for more information on this.

Box-Packing ↑ Back to Top

The box packer included with this shipping method lets you group items into packages of which you define the height, width, length, weight and max-weight. The packing is mainly volume based, but does also consider item sizes too.

The box packer is volume based. This will in most cases provide good results, but will never be as accurate as a real person packing a box (see BIN Packing Problem) therefore it is important you understand that packing results are as accurate as they can be and any anomalies should be accepted.

Setting up box sizes

Within the settings, look for the boxes setting. Click ‘add box’ to set up the boxes dimensions:

Box Settings

Box Settings

Outer dimensions are used for parcel dimensions and are passed to the API.

Inner dimensions are used for packing, and items will be fit within these.

Box weight is the weight of the actual box, and will be added to the weight of the contents. This will increase the cost of shipping.

Max weight is the maximum weight your box can hold. This includes contents weight and box weight.

How the calculation works

The packer does the following:

  1. Finds boxes which fit the items being packed (uses H x W x D).
  2. Packs all fitting items into boxes (using volume).
  3. The largest box which fits 100% of items is used *or* use the highest % packed box, and then pass unpacked items back (and repeat the process)
  4. Unpackable items are packed alone, using the item dimensions.
  5. All packed boxes are returned.

Customer Usage ↑ Back to Top

Customers will get quotes (after inputting their address) from two places;

  1. The cart page – by using the shipping calculator
  2. The checkout page – by filling in the shipping and billing forms
Rates can be selected by customers as normal.

Troubleshooting ↑ Back to Top

No rates returned/no rates available

  1. Ensure you have connected your production Canada Post account.
  2. Enable development mode, or turn on WP_DEBUG to see debugging information on the cart page. This will often reveal the problem.
  3. Check your products have sizes and weights set – without this the calculation cannot be performed.
  4. Check your store’s base country is Canada and that your using Canadian Dollars (from WooCommerce > Settings > General).

After attempting to authorize Canada Post, it brings me back to a page with a number 1 on the top left

You may need to update your permalink settings for WordPress to Pretty Permalinks.

Why are my lookups timing out?

Try opening Port 30000 for API communications.

Error message in cart: Fatal error: Cannot use object of type WP_Error as array in ../woocommerce-shipping-canada-post/shipping-canada-post.php

You can see this error message if your server can not use the wp_remote_get() function. This is something you can verify in the Status Report:


In this case, we recommend you to contact your hosting company so that they update your server.

Back to the top