Advanced Shipping Rules For WooCommerce

描述

Stop losing money on shipping costs — take full control of your WooCommerce shipping fees.

Advanced Shipping Rules For WooCommerce lets you create smart, conditional shipping rules that automatically apply extra fees based on what’s actually in the cart: total weight, number of items, or subtotal. Define as many conditions as you need, combine them with AND/OR logic, and let the plugin handle the rest at checkout — no developer required.

Whether you run a small shop or a high-volume store, getting shipping costs right is critical for both profitability and customer satisfaction. This plugin gives you the precision tooling you need.

Who is this for?

  • Store owners shipping heavy or bulky goods who need to recover real carrier surcharges for overweight shipments.
  • Shops with variable order sizes that want to add a handling fee when orders fall below a minimum quantity or total.
  • Multi-zone stores that need location-specific fee logic on top of WooCommerce’s native shipping zones.

How it works

The plugin adds a new shipping method — Advanced Shipping Rules — directly inside WooCommerce’s native shipping zones. You configure groups of conditions for each zone. When a customer’s cart matches a group, the defined extra fee is applied. Multiple groups use OR logic; conditions inside a group use AND logic. The highest matching fee wins, so you stay in control even when several rules could apply.

Key benefits

  • Accurate cost recovery: charge the real extra cost for heavy, bulky, or high-value orders instead of absorbing losses.
  • Fewer abandoned carts: transparent, rules-based fees at checkout are more trustworthy than flat-rate surprises.
  • Zero code: every rule is configured from the WooCommerce admin — no PHP, no hooks, no child theme edits.
  • Non-destructive: works alongside flat rate, free shipping, and any other method in the same zone.
  • Multiple instances: add the method more than once in a zone for layered fee structures.
  • Performance-friendly: no front-end scripts or styles are loaded; all logic runs only during cart/checkout calculation.

Available condition types

Condition
Operators

Cart total (subtotal)
equal to, less than, greater than

Total cart weight
equal to, less than, greater than

Number of products
equal to, less than, greater than

Extensible by developers

Three WordPress filters let you add custom condition types, evaluation handlers, and adjust the final shipping cost without modifying plugin files:

  • asrfwoo_condition_types — register new condition type definitions (description, operators, input type, step)
  • asrfwoo_condition_handlers — register the evaluation logic for each condition type
  • asrfwoo_shipping_cost — filter the final computed cost before it is passed to WooCommerce

Example: add a custom condition type based on the number of unique product categories in the cart.

add_filter( 'asrfwoo_condition_types', function( $types ) {
    $types['category_count'] = array(
        'description' => 'Number of Categories',
        'operators'   => array(
            'greater_than' => 'Greater than',
            'less_than'    => 'Less than',
            'equal'        => 'Equal to',
        ),
        'placeholder' => 'Enter category count',
        'input_type'  => 'number',
        'step'        => '1',
    );
    return $types;
} );

add_filter( 'asrfwoo_condition_handlers', function( $handlers ) {
    $handlers['category_count'] = function( $operator, $value, $cost, &$group_cost, &$is_condition_met, $cart_weight, $cart_items, $cart_total ) {
        $categories = array();
        foreach ( WC()->cart->get_cart() as $item ) {
            $terms = get_the_terms( $item['product_id'], 'product_cat' );
            if ( $terms ) {
                foreach ( $terms as $term ) {
                    $categories[ $term->term_id ] = true;
                }
            }
        }
        $count = count( $categories );
        if ( ( $operator === 'greater_than' && $count > (int) $value ) ||
             ( $operator === 'less_than'    && $count < (int) $value ) ||
             ( $operator === 'equal'        && $count === (int) $value ) ) {
            $group_cost      += $cost;
            $is_condition_met = true;
        }
    };
    return $handlers;
} );

HPOS compatible: fully tested with WooCommerce High-Performance Order Storage.

How to Use

  1. Open the method settings after adding it to a shipping zone.
  2. Click Add Group to create a rule group.
  3. Inside the group, click Add Condition and choose a condition type (weight, item count, or cart total), an operator, a threshold value, and an extra fee amount.
  4. Add more conditions to the same group (all must match — AND logic) or add a second group (either group can match — OR logic).
  5. Click Save changes. The fees will be applied automatically at checkout when the cart meets the defined conditions.

Example setups

  • Charge €5 extra when total cart weight exceeds 20 kg.
  • Charge €3 extra when the order contains fewer than 3 items.
  • Charge €10 extra when cart total is below €50 AND weight exceeds 10 kg.

License

This plugin is released under the GPL-2.0+ license.

屏幕截图

安装

  1. In your WordPress dashboard go to Plugins Add New Plugin, search for Advanced Shipping Rules For WooCommerce, and click Install Now.
  2. Activate the plugin.
  3. Go to WooCommerce Settings Shipping.
  4. Select an existing Shipping Zone or create a new one.
  5. Click Add shipping method, choose Advanced Shipping Rules for WooCommerce, and click Add shipping method.
  6. Click Edit on the new method to open its settings and define your conditions.

常见问题

Does this plugin replace WooCommerce’s built-in shipping methods?

No. It adds a new method that you place inside a shipping zone alongside flat rate, free shipping, or any other method. Each method calculates independently.

Can I use multiple instances of this method in one zone?

Yes. Add the method more than once to a zone to layer different fee rules for the same geographic area.

Does it work with WooCommerce shipping classes?

The free version evaluates cart-wide totals (weight, item count, subtotal), not per-product or per-class values.

Can I combine conditions with AND and OR logic?

Yes. Conditions within a single group are AND-ed (all must pass). Multiple groups are OR-ed (any matching group triggers its fee). The highest fee across all matching groups is applied.

Will this slow down my store?

No. The plugin loads no front-end assets. The condition evaluation runs only during WooCommerce’s shipping calculation phase.

Is it compatible with High-Performance Order Storage (HPOS)?

Yes. The plugin is fully HPOS compatible and does not rely on legacy order meta tables.

The method shows a €0 fee — why?

A fee is only added to the cart when at least one group matches and its cost is greater than zero. Check that your condition values and costs are saved correctly, and that the active cart meets the threshold you set.

评价

此插件暂无评价。

贡献者及开发者

「Advanced Shipping Rules For WooCommerce」是开源软件。 以下人员对此插件做出了贡献。

贡献者

更新日志

1.0.1

  • Fixed minor bugs in condition saving and display logic.

1.0.0

  • Initial release.
  • Cart total, cart weight, and product quantity conditions with AND/OR group logic.