Create a Custom Shipping Method for WooCommerce

Final product image
What You’ll Be Creating

WooCommerce is great. For a free e-commerce solution, it has an incredibly useful set of features.

But sometimes you need something extra. One occasion when I often find WooCommerce doesn’t give me everything I need is when it comes to setting up custom shipping methods.

Out of the box, WooCommerce lets you set the shipping rate for your own country or state, and for the rest of the world. Which is quite limiting. What if you want to set different shipping rates for different states of the USA, or for different parts of Europe?

If you’re feeling ambitious, you can code your own custom shipping method. But if you don’t want to go to those lengths, the WooCommerce Advanced Shipping plugin from CodeCanyon gives you a much flexibility as you could need.

In this tutorial, I’m going to show you how to set up custom shipping methods using the plugin. As I’m based in the UK, I’m going to set rates for the UK, the rest of Europe, the USA, and the rest of the world.

As you’ll see when we work through the process, you can use multiple conditions to define your shipping methods. These can include weight, shipping address, quantity of units, and a whole range of other options.

In my store, I’m going to use shipping location and weight to define my shipping methods, but you could easily add extra conditions to refine your shipping methods even more.

So let’s get started.

What You’ll Need

To follow along with this tutorial, you’re going to need:

  • A WordPress site with WooCommerce installed and configured.
  • The WooCoommerce Advanced Shipping plugin.
  • Some products added to your store with weights assigned.

What WooCommerce Gives You

Out of the box, WooCommerce gives you very little flexibility when it comes to shipping zones. You can define a shipping zone for your own territory and for the rest of the world, but that’s it:

WooCommerce default shipping zones

If you ship to multiple countries, or to different states in the USA, this won’t be enough for you.

With the plugin, you can add extra shipping zones as well as shipping classes, and you can tie these together with shipping methods.

Before we continue, let’s take a look at the difference between shipping zones, classes and methods. I don’t know about you, but I can find the terminology confusing.

  • A shipping zone is a location or territory. It could be a state, a country, a continent, or a combination of these. So if you’re based in the USA, you might need shipping zones for individual states or for groups of states, as well as for other countries. Your shipping zones will be based on what you have to pay for postage to different parts of the world.
  • A shipping class is a group of products with certain characteristics, or a complete order with those characteristics. Common criteria for shipping classes will include weight, dimensions and whether a product is fragile. You can create a class to group individual products or to define a complete order.
  • A shipping method brings zones and classes together. It is the rate which will apply to an order which ships to a given zone and has products in a certain class.

Shipping methods aren’t provided by WooCommerce out of the box. But the Advanced Shipping plugin gives you the options to add as many shipping methods as you like, and to make them as complex as you need.

Let’s start creating one.

Creating a Shipping Method

I’m going to create a set of shipping methods based on location and weight. For each location, I want a shipping method for orders weighing under 1 kg and orders over 1 kg. The zones I’ll be using are:

  • United Kingdom
  • Rest of Europe
  • USA
  • Rest of the world

Before we start, we need to delete any shipping zones already defined in the shipping settings. If we don’t do this, customers will have a choice between our new shipping methods and the existing ones. In the Shipping zones screen, delete all existing shipping zones.

Note: If you want, you can define shipping classes based on weight first, and then use these as one of your criteria when setting up the shipping method. I won’t do that here, but you might find it saves you time.

Now it’s time to create a custom shipping method. Let’s start by creating a relatively simple shipping method, for orders under 1 kg in the UK.

Go to WooCommerce > Settings > Shipping > Shipping Methods. This will take you to the Shipping Methods screen provided by the plugin.

The first step is to define the criteria. You can use ‘and’ criteria or ‘or’ criteria. You can also use criteria to exclude certain conditions, which I’ll demonstrate shortly.

My criteria is based on location and weight, so I’ll be adding both criteria together. First, I want to set the country. I select Country, then Equal to, and then United Kingdom.

Next, I define the weight. I select Weight, then Less or equal to, then type in 1kg.

Note: Make sure you use the same weight units here as you are using in your store overall. You can access this at WooCommerce > Settings > Products.

Here’s my shipping class defined:

Now scroll down and define what the costs will be for your shipping method.

These will depend on what it costs you to ship products. The options you have are:

  • Shipping title: a title you’ll remember
  • Shipping cost: the cost per order
  • Handling fee: a flat handling fee per order. In my store, I’m going to set the same handling fee for all of my shipping methods, with a different shipping cost for each one.
  • Cost per item: shipping cost per item. You can use this instead of or in addition to the shipping cost for the order if you need to.
  • Cost per weight: shipping cost for each kg of weight. You can use this as an alternative to creating multiple shipping methods for multiple weight bands. Or you could do both, with the cost per weight different for different weight bands.
  • Tax status: is shipping taxable or not? This will depend on your tax regime.

Its highly unlikely that you will use all of these, but you’ll probably be using one or two.

In my case, I’m setting a flat rate handling fee and a shipping cost for the order:

shipping settings

I can then set up a second shipping class for the UK, with a weight of greater than or equal to 1.01 kg.

Creating A Shipping Method Based on Negative Criteria

The beauty of this plugin is that it lets you combine ‘and’ and ‘or’ conditions and also lets you use negative conditions to create exactly the shipping method you need.

For my next pair of shipping methods, I’ll be focusing on the rest of Europe. So I want the continent to be Europe but the country not to be the UK.

So I’ll need the following:

  • Continent (or Country: it still works) equal to Europe.
  • Country not equal to United Kingdom.
  • Weight equal or less than 1kg.

This gives me three criteria, as you can see in the screenshot:

If I wanted to get even more granular, I could use ‘or’ groups to select individual countries, for example if I had one shipping method for France and Germany and another for the rest of Europe.

You can get as specific as you like, the plugin gives you lots of flexibility.

I now have two other sets of shipping methods to set up, one for the USA and one for the rest of the world.

  • For the USA, I’ll use two conditions: one for the country and another for the weight.
  • For the rest of the USA, I’ll use three conditions: continent not equal to Europe, country not equal to USA, and the weight.

I now have all of my shipping methods set up, which i can see on the Advanced Shipping overview screen:

shipping methods on the overview screen

Placing An Order

Now let’s see what happens when I place an order.

My shop has some dummy products in it and I’ve assigned weights to them. I’ve assigned a weight of 0.6 kg to my belt and 0.5 kg to my hoodie (I’ve made these weights up: in a real store you’d need to know the actual weight).

First, I’ll create an order for shipping to the UK for just a belt. This will put my order in the first shipping method I set up for the UK, as it’ll come in below 1 kg.

Here’s my cart, with the shipping cost to the UK shown:

shopping cart with 1 belt and UK shipping costs of 7

Now if I add a hoodie, the shipping will go up:

cart with a hoodie and belt and shipping cost of 10

Now if I keep those two items in my cart but change my shipping address, the shipping cost will go up again. This time I’m shipping to a US address, and the shipping goes up to £16.

cart with two items a USA address and 16 shipping

The plugin has taken my shipping address, the combined weight of the items in my cart, and worked out what the shipping cost will be. Clever!

Advanced Shipping Methods Will Help You Sell Worldwide

If you plan to sell to customers across the world, it’s important to ensure you don’t lose money by not charging the correct postage rates.

By setting as many advanced shipping methods as you need, you can charge exactly the right amount to your customers, no matter where they live and what they are buying. By installing the WooCommerce Advanced Shipping plugin and following these steps, you can configure your shipping exactly as you need it.

And while you’re here, check out some of our other posts on WooCommerce plugins.

Leave a comment

Your email address will not be published.