Standard shipping options in WooCommerce are often too limited for growing businesses that need to calculate rates by weight, price, or item count. Learning how to add a custom shipping method for WooCommerce is key to reducing cart abandonment and protecting your profit margins. This guide explores three proven ways to help you optimize your shipping strategy today.
Running a successful WooCommerce store often starts with a simple “Flat Rate” shipping option. But as your business grows, you quickly realize that shipping is not a one-size-fits-all solution. Perhaps you’ve hit a wall trying to set up shipping costs based on the weight of a parcel, or you want to offer your customers a specific courier service that isn’t available out of the box. Maybe you’ve noticed that customers are abandoning their carts because the shipping options are confusing or too expensive for small orders.
A WooCommerce custom shipping method is a shipping option that charges by rules you define, such as weight, order total, or destination, instead of a single fixed price. You need one when the built-in methods (Flat Rate, Free Shipping, and Local Pickup) can’t match how you really ship. In Ryder’s 2026 study, 71% of US shoppers had abandoned a cart over unanticipated shipping fees (Ryder 2026).
The truth is, standard WooCommerce settings only take you so far. To truly optimize your checkout experience and protect your margins, you need to know how to add a custom shipping method that aligns with your specific logistics.
There are three main ways to add a custom shipping method in WooCommerce, depending on your technical skills and business needs:
| Way | Best for | Skills | Rates by weight or order value? | Risk |
|---|---|---|---|---|
| Shipping zones and native methods | One price per zone | None | No (item count, percentage, and shipping classes only) | Low |
| PHP code | Logic no plugin offers | PHP | Yes, anything you code | Higher: maintenance and errors |
| Table rate plugin | Rules by weight, price, quantity, and more | None | Yes | Low |
If one price per zone is enough, use the native methods. If you need rules by weight or order value, use a table rate plugin. Write code only when you need logic that no plugin provides.
Before diving into complex code or external tools, it’s essential to understand what WooCommerce offers right out of the box. The easiest way to add a basic custom shipping method in WooCommerce is by using shipping zones. A Shipping Zone is a geographical area where a specific set of shipping methods is available. WooCommerce will match a customer to a single zone based on their shipping address, and only the methods within that zone will be displayed to them.
Go to your WordPress dashboard and head to WooCommerce > Settings > Shipping.

Define a Zone: Click on Add shipping zone button. Give your zone a name (e.g., “UK Mainland”) and select the regions included in this zone. You can even limit it to specific postcodes.

Add a Shipping Method: Inside your zone, click the Add shipping method button. A modal will appear allowing you to choose from three core options:

Choose Flat Rate and configure the method. Once added, click Edit under the method name to set the cost or specific requirements (like “Minimum order amount” for free shipping).
While this method is “free” and built-in, it is quite rigid. You will quickly encounter obstacles if you need:
Pro Tip: If your shipping strategy is purely based on “One price for everyone in the country,” this method is perfect. However, if you want to avoid overcharging customers or losing money on heavy shipments, you’ll likely need the more advanced methods described below.
If you have specific requirements that no standard setting can meet, you can create your own shipping method from scratch. This approach gives you total control over how the shipping cost is calculated and displayed. Please have in mind that it’s best suited for developers or stores with in-house technical resources.
To do this, you need to hook into WooCommerce and create a new class that extends the built-in WC_Shipping_Method class.
Every shipping method in WooCommerce is an instance of a class. Every shipping method in WooCommerce is a class that extends WC_Shipping_Method. To let merchants add your method to a shipping zone, you also need to declare that it supports shipping zones. You only need to “fill in the blanks” with your custom logic.
Simple Code Skeleton (PHP)
Below is a basic boilerplate to register a custom shipping method. This custom WordPress code should ideally go into a custom plugin or a child theme’s functions.php.
<?php
/**
* Plugin Name: Custom Shipping Method Example
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
add_action( 'woocommerce_shipping_init', 'custom_shipping_method_init' );
add_filter( 'woocommerce_shipping_methods', 'custom_shipping_method_register' );
function custom_shipping_method_register( $methods ) {
$methods['custom_shipping'] = 'WC_Custom_Shipping_Method';
return $methods;
}
function custom_shipping_method_init() {
if ( class_exists( 'WC_Custom_Shipping_Method' ) ) {
return;
}
class WC_Custom_Shipping_Method extends WC_Shipping_Method {
public function __construct( $instance_id = 0 ) {
$this->id = 'custom_shipping';
$this->instance_id = absint( $instance_id );
$this->method_title = __( 'Custom Shipping', 'text-domain' );
$this->method_description = __( 'A simple custom shipping method.', 'text-domain' );
$this->supports = array(
'shipping-zones',
'instance-settings',
'instance-settings-modal',
);
$this->init();
}
public function init() {
$this->instance_form_fields = array(
'title' => array(
'title' => __( 'Method title', 'text-domain' ),
'type' => 'text',
'default' => __( 'Custom shipping', 'text-domain' ),
),
'cost' => array(
'title' => __( 'Cost', 'text-domain' ),
'type' => 'number',
'default' => '10',
),
);
$this->title = $this->get_option( 'title' );
}
public function calculate_shipping( $package = array() ) {
$this->add_rate(
array(
'id' => $this->get_rate_id(),
'label' => $this->title,
'cost' => $this->get_option( 'cost' ),
'package' => $package,
)
);
}
}
}
While coding your own method is powerful, it comes with significant responsibilities:
Important: If you are not comfortable with PHP or FTP access, we strongly recommend using a dedicated plugin. It ensures your site stays stable and receives regular updates.
For most store owners, using a plugin is the fastest and safest way to add a custom shipping method for WooCommerce. If you need a solution that is flexible, secure, and ready to use in minutes, a dedicated plugin is the way to go. In such cases, tried and tested solutions work best. And when it comes to shipping in WooCommerce, there is probably nothing better than the Flexible Shipping plugin. It’s the most popular Table Rate shipping plugin for WooCommerce, used by over 100,000 stores worldwide. This plugin is based on the table rate solution, which is the simplest solution for implementing more complex shipping scenarios in WooCommerce.
Table Rate shipping allows you to create complex rules based on conditions. Instead of a single flat fee, the shipping cost “adapts” to the contents of the customer’s cart.
Install the Plugin: Search for Flexible Shipping in the WordPress plugin repository, install, and activate it. You can also use the link below.
The best Table Rate Shipping for WooCommerce. Period. Create shipping rules based on weight, order totals, or item count.
Go to WordPress.orgorDownload for freeHaving the plugin installed and activated, add a New Shipping Method: Go to WooCommerce > Settings > Shipping. Then, select a Shipping Zone, and click Add shipping method. Choose “Flexible Shipping” from the list.

Configure Your Rules: Click on the method name to open the configuration panel. This is where the magic happens.

In the configuration page, you can enter both the Method Title, Method Description and use all of the Flexible Shipping plugin’s features. The most important element, however, is the Shipping Cost Calculation Rules table. You’ll find it at the bottom of the configuration page:

Set the rules so that each range ends just below the start of the next one:
Leave to empty on the last rule. This avoids gaps and overlaps, because Flexible Shipping adds up the costs of all matching rules by default. For more examples, see our guide to the WooCommerce shipping calculator.
This means that for orders with a weight of up to 1 kg, the shipping rate is £10. Over 1 kg, up to 5 kg, it’s £11. And finally, over 5 kg is £12. In your case, the costs and ranges may be different. Remember that these ranges refer to the total weight of all the products in your customer’s shopping cart.

Below you will find a video exploring the topic of WooCommerce weight-based shipping in more detail.

The biggest benefit of this method is that you never touch a single line of code. Everything is managed through a clean, intuitive interface. If you decide to change your shipping rates for a Black Friday sale or due to a carrier price hike, you can do it in seconds with a few clicks.
It’s a shipping option that charges by rules you define, instead of the fixed price of Flat Rate. You can add one with shipping zones, PHP code, or a table rate plugin. It’s useful when you need rates by weight, order value, quantity, or product type.
Yes. Shipping zones let you add Flat Rate, Free Shipping, and Local Pickup. For rules by weight or order value, a table rate plugin such as Flexible Shipping creates a custom method without PHP code.
Create a class that extends WC_Shipping_Method, declare that it supports shipping zones, and add your cost logic in calculate_shipping(). Register the class with the woocommerce_shipping_methods filter, then add the method to a zone. Test it on a staging site first.
Put it in a small custom plugin. A child theme’s functions.php also works, but the code disappears if you change the theme. Avoid editing the parent theme.
A shipping zone defines where you ship, based on the customer’s address. A shipping method defines how much you charge within that zone. One zone can contain several methods.
Flat Rate can scale with item count, a percentage of the order, and shipping class costs. A custom method is better when rates depend on weight or order-value ranges, or on conditions Flat Rate doesn’t support.
Poorly written code can, especially when the calculations are complex or call external services. Well-maintained plugins are built for checkout performance. Test the cart and checkout after any change.
Yes. Table rate plugins can hide a method based on conditions such as weight or product, and PHP code can do the same through WooCommerce filters. See our guide to disabling a shipping method for certain products.
Customizing your shipping methods is one of the most effective ways to professionalize your WooCommerce store. While the built-in options provide a solid foundation for simple setups, and custom coding offers limitless (though risky) flexibility, most successful stores find their “sweet spot” with a dedicated plugin. Choosing the right approach depends on how complex your shipping logic is and how much control you need.
Ready to move beyond basic flat rates? Install the free Flexible Shipping plugin and create your first custom rule in minutes. If you need rules by quantity, shipping class, or product category, see Flexible Shipping PRO.
Learn how Octolize helped Kurzgesagt, the online shop behind one of YouTube’s most popular science channels, set up conditional courier rules using the Shopify Shipping Rates Rules & Zones app.
Learn how Octolize solutions helped WooCommerce store based in the United Kingdom set up shipping scenarios.
Learn how Octolize helped Shopify store based in the USA set up distance based rates with a usage of Octolize Distance Based Rates.