Canada Post is a premium shipping method which let you get shipping rates from Canada Post’s API. It requires that your store uses Canadian Dollars for it’s currency and that your server has SimpleXML installed. The extension primarily works with cm and kg, but other units can be converted automatically.
Canada Post can calculate quotes worldwide as it handles both domestic and international parcels.
Installation ↑ Back to Top
- Upload the plugin folder to the ‘/wp-content/plugins/’ directory.
- Activate the plugin through the ‘Plugins’ menu in WordPress.
- Thats it – you can now configure the plugin.
Getting Started ↑ Back to Top
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:
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.
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:
Configuration ↑ Back to Top
You configure the plugin through WooCommerce > Settings > Shipping Methods > Canada Post.
- Enable/Disable – Choose whether to enable the shipping method of not.
- Method Title - Name the shipping method. This will be visibile by customers.
- Origin Postcode – This should be set to the postcode from which you will ship. It is sent to the Canada Post API.
- 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.
- Debug Mode – If you enable this, API requests and responses will be shown on the cart and checkout pages. Useful when debugging rates.
- 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.
- Rate Cost – Determines which rate is used. “Base” is the base rate cost, “due” is the cost after taxes have been applied.
- 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.
- Additional Options – Choose additional options for your parcels.
- 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.
- Parcel Packing Method – See below.
- Offer Rates – Choose to return all rates (user will get the choice) or just return a single rate.
- 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.
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.
Setting up box sizes
Within the settings, look for the boxes setting. Click ‘add box’ to set up the boxes dimensions:
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:
- Finds boxes which fit the items being packed (uses H x W x D).
- Packs all fitting items into boxes (using volume).
- 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)
- Unpackable items are packed alone, using the item dimensions.
- All packed boxes are returned.
Customer Usage ↑ Back to Top
Customers will get quotes (after inputting their address) from two places;
- The cart page – by using the shipping calculator
- The checkout page – by filling in the shipping and billing forms
Troubleshooting ↑ Back to Top
No rates returned/no rates available
- Ensure you have connected your production Canada Post account.
- Enable development mode, or turn on WP_DEBUG to see debugging information on the cart page. This will often reveal the problem.
- Check your products have sizes and weights set – without this the calculation cannot be performed.
- 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.