Black Friday Month: 30% off WooCommerce plugins & bundles · Until Nov 30

Shop now →

WooCommerce Custom Shipping Method: How to Add One (3 Ways)

How to Add a Custom Shipping Method for WooCommerce
Updated:
2026-11-20
Reading time:
8 minutes read
Category:
Blog, WooCommerce

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.

Key Takeaways

  • A WooCommerce custom shipping method is a shipping option with your own rules, created when flat rate, free shipping, and local pickup aren’t enough.
  • You can add one in three ways: with shipping zones and built-in methods, with PHP code, or with a table rate plugin such as Flexible Shipping.
  • Native methods can’t price by weight or order-value ranges. Code or a plugin can.
  • Shipping cost is a conversion issue: 40% of US shoppers who abandon a purchase (excluding “just browsing”) cite extra costs such as shipping (Baymard Institute, 2026).

What Is a WooCommerce Custom Shipping Method?

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).

Why Custom Shipping is a Game-Changer for Your Store

  • Custom shipping helps you protect your margins by matching shipping costs to the real effort required to fulfill an order, instead of relying on flat rates that either overcharge customers or silently eat into your profit.
  • Custom shipping allows you to tailor delivery options to what you actually sell, whether that means charging more for heavy products, offering cheaper shipping for small orders, or promoting free shipping only when it makes business sense.
  • Custom shipping prevents operational issues at checkout by removing unrealistic options, reducing manual order corrections, customer complaints, and refunds caused by shipping promises you can’t reliably keep.

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:

  • The Native Way: Utilizing built-in WooCommerce features for basic needs.
  • The Developer Way: Adding custom methods via PHP code for those who want full control.
  • The Efficient Way: Using a “No-Code” plugin like Flexible Shipping to create advanced, rule-based shipping in minutes.

Which Way Should You Choose?

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.

Method 1: Using Built-in WooCommerce Shipping Zones (The Basics)

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.

Need more information? Check out our guide to shipping zones in WooCommerce.

How to Add a Basic Method Step-by-Step:

Go to your WordPress dashboard and head to WooCommerce > Settings > Shipping.

WooCommerce shipping zones view

 

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.

UK Mainland WooCommerce shipping zone

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:

  • Flat Rate: A fixed charge for shipping.
  • Free Shipping: Triggered by coupons or minimum order amounts.
  • Local Pickup: Allows customers to collect orders themselves.

create new WooCommerce shipping method

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).

The Limitations of the Native Approach

While this method is “free” and built-in, it is quite rigid. You will quickly encounter obstacles if you need:

  • Shipping costs that increase based on product weight.
  • Different rates for different shipping classes within the same order.
  • Advanced logic, such as “Buy 3 items, get shipping for $5.”

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.

Method 2: Adding a Custom Shipping Method via Code (For Developers)

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.

The Core Concept

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,
                )
            );
        }
    }
}

Risks of Adding a Custom Shipping Method via Code

While coding your own method is powerful, it comes with significant responsibilities:

  • The “White Screen of Death”: A single missing semicolon in your functions.php file can take your entire website offline.
  • Maintenance Burden: Every time WooCommerce or WordPress updates, you are responsible for ensuring your code remains compatible.
  • Security & Performance: Inefficient code in the checkout process can slow down your site and lead to lost sales.

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.

Method 3: Using a Plugin for Advanced Customization (The Efficient Way)

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.

Why use a “Table Rate” approach?

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.

Read more about WooCommerce Table Rate.

How to Set Up Custom Rules (Step-by-Step)

Install the Plugin: Search for Flexible Shipping in the WordPress plugin repository, install, and activate it. You can also use the link below.

Flexible Shipping WooCommerce

The best Table Rate Shipping for WooCommerce. Period. Create shipping rules based on weight, order totals, or item count.

Go to WordPress.orgorDownload for free
100,000+ Active Installations
30-day money back guarantee
Last Updated: 2026-11-18
Works with WooCommerce 10.9 - 11.3.x

Having 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.

choose flexible shipping as a WooCommerce shipping method

 

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

Flexible Shipping method - general settings

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:

Shipping Cost Calculation Rules table

Example: Shipping Based on Weight

Set the rules so that each range ends just below the start of the next one:

  • 0 to 0.999 kg: £10
  • 1 to 4.999 kg: £11
  • 5 kg and above: £12

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.

basic weight based shipping configuration table

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

The “No-Code” Advantage

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.

FAQ: Custom Shipping Methods in WooCommerce

What is a WooCommerce custom shipping method?

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.

Can I add a custom shipping method without coding?

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.

How do I add a custom shipping method with 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.

Where should I put the shipping method code?

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.

What is the difference between a shipping zone and a shipping method?

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.

When should I use a custom method instead of Flat Rate?

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.

Will a custom shipping method slow down my checkout?

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.

Can I hide a custom shipping method for certain products?

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.

Summary

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.

Content Writer at Octolize

Bartosz Gajewski is a content and marketing specialist with a solid background in SEO, WordPress content strategy, and technical documentation for digital products. With years of hands-on experience in both in-house and freelance roles, he supports tech companies – especially in the SaaS and e-commerce space – by creating content that informs, engages, and drives results.

His approach blends storytelling with data-driven SEO, and he’s been involved in projects ranging from rebranding and product marketing to growth experiments and copywriting for complex software tools. On the blog, he shares actionable insights from his work across marketing teams, product documentation, and online store optimization.

Comments
Subscribe
Notify of
guest
0 Comments

Check out our case studies

Kurzgesagt x Octolize Shipping Rates Rules & Zones Shopify app case study
Kurzgesagt

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.

Castle Sefton Press featured image
Castle Sefton Press

Learn how Octolize solutions helped WooCommerce store based in the United Kingdom set up shipping scenarios.

Case study Metuchen
Metuchen Mower

Learn how Octolize helped Shopify store based in the USA set up distance based rates with a usage of Octolize Distance Based Rates.