Bestseller Documented

Custom Shipping Methods for WooCommerce

(4 customer reviews)

From: $29.99 / year

Add custom shipping methods to WooCommerce.

$29.99 Single site1 year of updates and support30-day money-back guaranteeBuy
$79.99 Unlimited sites1 year of updates and support30-day money-back guaranteeBuy
Clear

With Custom Shipping Methods for WooCommerce Pro plugin you can add custom shipping methods to WooCommerce.

Custom Shipping Methods for WooCommerce - Custom Shipping General Settings

In addition to standard WooCommerce cost calculation shortcodes ([qty], [cost], [fee]) you can also use [weight] and [volume] shortcodes.

The plugin also includes:

  • [costs_table] shortcode for the table rate shipping,
  • [distance] shortcode for distance based cost calculation,
  • options to set free shipping minimum order amount,
  • options to set min and max cost limits,
  • options to set custom shipping methods frontend icons and descriptions,
  • min/max cost/weight/volume/quantity method availability options.

Costs Table

[costs_table] shortcode has two attributes: prop and table.

prop attribute can be: volume, weight, qty, cost or distance.

table attribute sets costs based on prop attribute’s value, in min_prop-cost format.

Costs Table by Items Volume

Items volume is calculated by multiplying each item’s width, height and length.

[costs_table prop="volume" table="0-10|50-50|100-125.5"]

This example will set costs according to this table:

Volume Shipping Cost
from 0 and below 50 10
from 50 and below 100 50
from 100 125.5

Costs Table by Items Weight

[costs_table prop="weight" table="0-10|50-50|100-125.5"]

This example will set costs according to this table:

Weight Shipping Cost
from 0 and below 50 10
from 50 and below 100 50
from 100 125.5

Costs Table by Items Quantity

[costs_table prop="qty" table="0-20|10-10|20-0"]

This example will set costs according to this table:

Quantity Shipping Cost
from 0 and below 10 20
from 10 and below 20 10
from 20 free

Costs Table by Order Amount

[costs_table prop="cost" table="0-20|10-10|20-0"]

This example will set costs according to this table:

Order Amount (i.e. Order Cost) Shipping Cost
from 0 and below 10 20
from 10 and below 20 10
from 20 free

Costs Table by Distance

Distance is calculated same as in [distance] shortcode. Also same attributes (key, default_distance, units, src, debug) are applied.

[costs_table prop="distance" table="0-10|50-50|100-125.5" key="BIzbSyBNBNR9yi3vTgC33oXSpwQftScNSmO-fjc" default_distance="100" units="km"]

* Please note that key from example is not a valid key – you need to get your own key here.

This example will set costs according to this table:

Distance Shipping Cost
from 0 and below 50 km 10
from 50 and below 100 km 50
from 100 km 125.5

Distance based Cost Calculation

[distance] shortcode has five possible attributes:

  • key – this is a required attribute. Plugin uses Google Distance Matrix API to calculate the distance, so you need to get your API key here. Please note that you need to check “Routes” when getting your key from Google.
  • default_distance – this is a default distance for shipping (in case if customer didn’t enter his address yet or distance can’t be calculated). Default: 0.
  • units – units in which distance is calculated. Possible values: m for meters (default), km for kilometers and mi for miles.
  • src – source point (origin). By default it’s automatically retrieved from your shop’s settings from “WooCommerce > Settings > General > Store Address”. If you wish to set it manually – correct format is: address, city postcode, country.
  • debug – if set to yes, will output debug information in “WooCommerce > Status > Logs”. Default: no.

[distance] Example

1.5*[distance key="BIzbSyBNBNR9yi3vTgC33oXSpwQftScNSmO-fjc" default_distance="15" debug="yes" units="km"]

* Please note that key from example is not a valid key – you need to get your own key here.

Rounding

If you need to round some values, you can use [round], shortcode, e.g.:

[round][weight]/100[/round]

[round] shortcode attributes:

  • type – rounding type. Can be up, down and normal. Default is normal.
  • precision – rounding precision. Used for normal rounding type only. Sets the number of decimal digits to round to. Default is 2. This is the same parameter as in PHP round() function:

    If the precision is positive, the rounding will occur after the decimal point. If the precision is negative, the rounding will occur before the decimal point. If the absolute value of the precision is greater than or equal to the number of digits, the result of the rounding is equal to 0

Availability Options

For each custom shipping method you can optionally set min/max cost/weight/volume/quantity method availability options.

Custom Shipping Methods for WooCommerce - Availability Settings

Shipping Class Costs Options

As in standard WooCommerce shipping methods, you can optionally set shipping class costs, i.e. costs that are based on the product shipping class.

Custom Shipping Methods for WooCommerce - Shipping Class Costs Settings

General Options

General plugin options are located in “WooCommerce > Settings > Custom Shipping Methods”.

Custom Shipping Methods for WooCommerce - General Options

Admin Settings: Admin title
Sets custom shipping’s admin title. Visit “WooCommerce > Settings > Shipping” to set each method’s options.
Default: Custom shipping
Frontend Settings: Trigger checkout update
Will trigger the checkout update on any input change. This is useful if you are using cost calculation by distance to the customer.
Default: no
Frontend Settings: Add to zero cost
Will add text to custom shipping cost on frontend in case if it’s zero (i.e. free).
Default: no
Frontend Settings: Add to zero cost: Text
Text to add to zero cost. Ignored if “Add to zero cost” option above is disabled.
Default: None
For example:
<span style="color:green;font-weight:bold;">Free!</span>
Icons & Descriptions: Enable section
Enables icons and descriptions options for custom shipping methods. Visit “WooCommerce > Settings > Shipping” to set each method’s icon and description.
Default: no
Icons & Descriptions: Icon template
Sets template for the icons. Replaced value: %icon_url%.
Default:
<img style="display:inline;" src="%icon_url%">
Icons & Descriptions: Description template
Sets template for the descriptions. Replaced value: %desc_text%.
Default:
<p style="font-size:small;font-style:italic;">%desc_text%</p>
Icons & Descriptions: Final template
Sets final template. Replaced values: %icon%, %label%, %desc%.
Default:
%icon%%label%%desc%

4 reviews for Custom Shipping Methods for WooCommerce

  1. Christophe (verified owner)

    plugin works well, but the support is non existing

  2. Kevin (verified owner)

    Excellent support. Very helpful and quick to respond!

  3. Luis Ramos (verified owner)

    Does exactly what it says on the tin. Superb support from Tom. Highly recommended!

  4. Sjors

    Perfect plugin, just what I needed. And thanks to Tom for quick support.

Add a review

Your email address will not be published. Required fields are marked *

Free version

This plugin is a premium version of free "Custom Shipping Methods for WooCommerce" plugin.

If you need to modify custom shipping method's cost, there is a filter for that:

alg_wc_custom_shipping_methods_add_rate

For example, let's say you are using product shipping classes when calculating shipping cost and you need to deduct the least expensive shipping class amount from the final shipping cost for orders having 4 or more products. This is the code you would need to add to your (child) theme's functions.php file:

if ( ! function_exists( 'my_alg_wc_custom_shipping_methods_deduct_lowest_class' ) ) {
    /**
     * my_alg_wc_custom_shipping_methods_deduct_lowest_class.
     */
    function my_alg_wc_custom_shipping_methods_deduct_lowest_class( $rate, $package, $shipping_method ) {
        $min_products_count = 4;// Here you set how many products there should be in cart at least
        if ( ! isset( $package['contents'] ) || count( $package['contents'] ) < $min_products_count ) {
            return $rate;
        }
        $shipping_classes = WC()->shipping->get_shipping_classes();
        if ( ! empty( $shipping_classes ) ) {
            $found_shipping_classes = $shipping_method->find_shipping_classes( $package );
            $lowest_class_cost      = false;

            foreach ( $found_shipping_classes as $shipping_class => $products ) {
                // Also handles BW compatibility when slugs were used instead of ids
                $shipping_class_term = get_term_by( 'slug', $shipping_class, 'product_shipping_class' );
                $class_cost_string   = $shipping_class_term && $shipping_class_term->term_id ? $shipping_method->get_option( 'class_cost_' . $shipping_class_term->term_id, $shipping_method->get_option( 'class_cost_' . $shipping_class, '' ) ) : $shipping_method->get_option( 'no_class_cost', '' );

                if ( '' === $class_cost_string ) {
                    continue;
                }

                $has_costs  = true;
                $class_cost = $shipping_method->evaluate_cost( $class_cost_string, apply_filters( 'alg_wc_custom_shipping_methods_evaluate_cost_args_class', array(
                    'qty'  => array_sum( wp_list_pluck( $products, 'quantity' ) ),
                    'cost' => array_sum( wp_list_pluck( $products, 'line_total' ) ),
                ), $products ) );

                $lowest_class_cost = $class_cost < $lowest_class_cost || false === $lowest_class_cost ? $class_cost : $lowest_class_cost;
            }

            if ( $lowest_class_cost ) {
                $rate['cost'] -= $lowest_class_cost;
            }
        }
        return $rate;
    }
    add_filter( 'alg_wc_custom_shipping_methods_add_rate', 'my_alg_wc_custom_shipping_methods_deduct_lowest_class', PHP_INT_MAX, 3 );
}

Changelog

1.8.0 - 16/09/2021

  • Fix - Required Categories and Required Tags rules were not applied for Custom Shipping methods.
  • WC tested up to: 5.6

1.7.1 - 30/07/2021

  • Fix - Unwanted messages appearing on Cart and Checkout pages.
  • WC tested up to: 5.5
  • WP tested up to: 5.8

1.7.0 - 09/07/2021

  • Dev - Filter added to modify the totals. This can be used to consider totals with taxes.
  • Dev - Refactorted the code as per WPCS standards.
  • WC tested up to: 5.4

1.6.2 - 18/02/2020

  • Fix - Admin Settings - Text domain fixed.
  • Dev - Availability - "Require type" option added.

1.6.1 - 22/01/2020

  • Dev - Shortcodes - [round] shortcode added.
  • Dev - Code refactoring.
  • WC tested up to: 3.9.

1.6.0 - 30/12/2019

  • Dev - Availability - "Required/Excluded products/categories/tags" options added.
  • Dev - "Free shipping products" option added.
  • Dev - Settings - Icons & Descriptions - Placeholders list added to the description.
  • Dev - Code refactoring.

1.5.3 - 11/12/2019

  • Dev - Shortcodes - [distance] - Caching results now.
  • Dev - Code refactoring.

1.5.2 - 06/12/2019

  • Dev - Availability - "Min distance" and "Max distance" options added.
  • Dev - Advanced - "Custom return URL" option added.
  • Dev - Shortcodes - [costs_table] - Evaluating math expressions in costs now.
  • Dev - Admin settings descriptions updated.
  • Dev - Code refactoring.

1.5.1 - 13/11/2019

  • Dev - Shortcodes - [distance] - Returning default_distance at once when source or destination address is empty.
  • WC tested up to: 3.8.
  • Tested up to: 5.3.

1.5.0 - 23/10/2019

  • Feature - Shortcodes - [distance] - Rounding attributes added (rounding and rounding_precision).
  • Feature - Shortcodes - [distance] - Min and max distance attributes added (min_distance and max_distance).
  • Dev - Code refactoring.

1.4.3 - 03/10/2019

  • Dev - General - Frontend Settings - Add to zero cost - Admin settings descriptions updated.
  • WC tested up to: 3.7.

1.4.2 - 14/06/2019

  • Dev - Shipping class costs - "Limits calculation" option added.
  • Dev - Admin settings descriptions updated ("Free shipping min amount").
  • Dev - Minor code refactoring.

1.4.1 - 25/05/2019

  • Dev - General - Frontend Settings - Trigger checkout update - Now triggering checkout update only on billing_ and shipping_ input change.
  • Dev - General - Frontend Settings - Add to zero cost - Admin settings descriptions updated.

1.4.0 - 24/05/2019

  • Feature - Shortcodes - [costs_table] - table_format attribute added (defaults to min; other possible value: range) (and default_cost attribute added).
  • Feature - Shortcodes - [distance] - Miles (mi) option added to the units attribute (same applies to [costs_table prop="distance" ...]).
  • Dev - General - Frontend Settings - "Trigger checkout update" option added.
  • Dev - Shortcodes - [distance] - default attribute renamed to default_distance.
  • Dev - WC_Shipping_Alg_Custom - alg_wc_custom_shipping_methods_add_rate filter added.
  • Dev - WC_Shipping_Alg_Custom - evaluate_cost() function visibility changed from protected to public.
  • WC tested up to: 3.6.
  • Tested up to: 5.2.

1.3.1 - 09/02/2019

  • Feature - [costs_table] - cost property added (i.e. [costs_table prop="cost" ...]).
  • Feature - "Free shipping minimum order amount" option added.
  • Dev - [costs_table] - Code refactoring.
  • Dev - Admin settings restyled.

1.3.0 - 03/12/2018

  • Feature - "Min cost limit" and "Max cost limit" options added.
  • Feature - [distance] shortcode added.
  • Feature - distance prop added to the [costs_table] shortcode (i.e. [costs_table prop="distance"]).
  • Dev - Method settings descriptions updated.
  • Dev - alg_wc_custom_shipping_methods_evaluate_cost_sum and alg_wc_custom_shipping_methods_evaluate_cost_sum_evaluated filters added.

1.2.1 - 14/11/2018

  • Feature - "Replace zero cost" options added.
  • Dev - Code refactoring.

1.2.0 - 18/09/2018

  • Feature - "Method icon" and "Method description" options added.
  • Fix - [costs_table] shortcode fixed.
  • Dev - Admin settings restyled.

1.1.0 - 14/09/2018

  • Feature - Availability - "Min cost", "Max cost", "Min volume", "Max volume", "Min quantity", "Max quantity" options added.
  • Fix - Core - Checking if product has dimensions before calling get_height(), get_width() and get_length() in get_products_volume().
  • Fix - Core - Checking if product has weight before calling get_weight() in get_products_weight().
  • Dev - Default "Admin title" and "Method title" values updated.
  • Dev - Minor admin settings restyling.
  • Dev - Code refactoring.
  • Dev - POT file added.
  • Dev - Plugin description in readme.txt updated.
  • Dev - Plugin URI updated.

1.0.0 - 09/05/2018

  • Initial Release.