WooCommerce Tutorials

How to Setup the Canada Post WooCommerce Shipping Plugin

The Canada Post WooCommerce plugin is one best way to get shipping rate details from Canada Post, Canada’s primary postal operator. It works as a premium shipping method that provides realtime shipping rates from Canada Post’s API.

To use this extension, two criteria are required to be satisfied. First, your store needs to use Canadian Dollars. Second, your server has SimpleXML installed.

Canada Post manages both, domestic and international parcels.

Installation

  • Login to your WooThemes Account
  • Download .zip files from the account
  • Go to WordPress Admin > Plugins > Add New to upload the file that was downloaded with Choose File
  • Activate the extension

Canada Post – Getting Started

Link your Canada Post account first. Find the notification bar at the top of the admin screen, which will prompt you to Register/Connect.

canadapost connect

The plugin recommend using pretty permalinks before connecting your Canada Post account to avoid an error caused by Canada Post. To know more about permalinks, check the Codex, and choose any option except default.

  • Click the Register/Connect button and you will be taken to Canada Post’s website.
  • Login to your account or register as a new user if you don’t have an account already. Once created, WooThemes will start getting shipping quotes from the API on your behalf.
  • Canada Post might also ask you to enter a credit card detail for few future automatic transactions, like monthly fees, transaction charges, etc. You can submit the details now or update it later when you sign into My Business Profile on the Canada Post Dashboard.

Upon completion, you will be sent automatically to the admin panel.

NB: To disconnect your account in the future, click the link at the top of the Settings page.

canada post account

Canada Post – Setup & Configuration

Setup the payment gateway by going to WooCommerce > Settings > Shipping > Canada Post

canada post settings

  • Enable/Disable – Tick the checkbox to offer Canada Post as a shipping method.
  • Method Title – Give a short description. This will be shown to customers during checkout.
  • Origin Postcode – Give the postal code of the location from where shipping originates. The info will be also sent to the API to calculate rates.
  • Method Availability – Set it to All Countries or restrict it to certain countries as per your suitability. We recommend the former so that it is available to all your customers.
  • Debug Mode – Tick the checkbox if you want to log every request and response made in the Cart and Checkout pages. Useful for troubleshooting.
  • Quote Type – Commercial uses rates and discounts associated with your account. Counter uses normal rates that you will receive in person. Commercial is also used for VentureOne members.
  • Rate Cost – Two types: Base and Due. The former is base rate cost and latter is cost after taxes.
  • Lettermail – Select Standard and/or Registered rates from the dropdown. Lettermail isn’t a part of the Canada Post API and, therefore, rates are calculated by taking box packing and hard coded prices into account.
  • Additional Options – Select Coverage, Proof of Age, and/or Signature for parcels from the dropdown.
  • Delivery Time – Tick the checkbox to get delivery estimate (in days) displayed alongside rates. (Info pulled from the API).
  • Parcel Packing Method – Use the dropdown to select Pack individually. Weight of All items, or Pack with Weights and Dimensions (explained below).
  • Maximum weight –  Define the maximum weight per package.
  • Offer Rates – Select All Rates (User Choice) or Cheapest Rate (Single) from the dropdown.
  • Services – Rename and reorder Canada Post shipping rates. Add price rates by percentage or fixed dollar amount. Adjustments are positive (surcharge/fee) or negative (discount).

canada post services

Parcel Packing Methods

3 packing methods exist with Canada Post; each affects parcels sent to the API

  • Per Item – Items in your cart (non-virtual) are sent to the Canada Post API. The final cost involves quotes of all items combined.
  • Weight Based – The cart needs to be segregated into 30kg packages, details of which are sent to the API. Details include weight only, not dimensions.
  • Pack Into Boxes – Items are packed in pre-defined boxes and sent to the API. For more options, see Box Packing.

Box-Packing

Box packer lets you group items into packages wherein you define height, width, length, weight, and max-weight. Packing considers volume on a primary basis, but item size is also considered.

Setting Up Box Sizes

Set up box dimensions by clicking Add Box.

Outer dimensions refer to the parcel dimensions, an info which is passed to the API.
Inner dimensions are used for packing. It must ensure that items fit within them.
Box weight or in simple terms, weight of the box is the additional weight the cost of which is also included with shipping.
Max weight is the maximum threshold of your box. This includes content weight and box weight.

How The Calculation Works?

The packer does the following:

  • Finds boxes that would fit the item needed to be packed, using HxWxD
  • Packs all items into boxes
  • Uses the largest box that would plausibly accommodate 100% of items; or uses highest percentage of packed box, return unpacked items, and then repeats the process.
  • Packs ‘unpackable’ items alone, using item dimensions.
  • Returns all packed boxes.

Customer Usage

When customers submit their address, they get quotes from 2 places:

  •  Cart Page – using the shipping calculator
  • Checkout Page – by filling shipping and billing forms

Troubleshooting

  • Check if your production Canada Post account is connected or not?
  • Enable development mode, or turn on WP DEBUG to view debugging information on the cart page. This reveals the issue most of the time.
  • Check if product sizes and weights are set or not, since without them calculation cannot be performed.
  • Finally, ensure you have selected your store’s base country as Canada and base currency as Canadian Dollar (WooCommerce > Settings >General).

FAQs

Q: After attempting to authorize Canada Post, it brings me back to a page with a number 1 on the top left.
A: You may need to update your permalink settings for WordPress to Pretty Permalinks.

Q: Why are my lookups timing out?
A: Try opening Port 30000 for API communications.

Q: Error message in cart: Fatal error: Cannot use object of type WP_Error as array in ../woocommerce-shipping- canada-post/shipping- canada-post.php.
A: If you are seeing this message, your server is unable to use the wp_remote_get() function. This can be verified using the Status Report:

canada post wp_remote_get

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

Hope this blog simplifies the Canada post plugin. If you have any questions, let us know in the comments.

If you want to discuss more about the Canada post plugin with the team, or need help in configuring or customizing the plugin, please feel free to contact us.