Shipping Rules, Restrictions and Surcharges for Magento 2

Kowal ShippingRules is a Magento 2 module for advanced shipping management in an online store.
Compatibility
2.4.9, 2.4.8, 2.4.7, 2.4.6, 2.4.5, 2.4.4, 2.4.3, 2.4.2, 2.4.1, 2.4.0, 2.3.7, 2.3.6, 2.3.5, 2.3.4
€61.50
per item
Email to a Friend

Enquire about this product

Description / Shipping Rules, Restrictions and Surcharges for Magento 2

MAGENTO 2 · SHIPPING METHODS · RESTRICTIONS · EXTRA FEE

Match shipping methods and costs to your real logistics.

Kowal Shipping Rules

Create custom shipping methods, conditional rates, and restrictions. Add fees for the cart or matching products and keep them accounted for in the order, invoice, and credit memo.

Magento Rule UI conditions · Product shipping types · Amasty migration

HOW IT WORKS IN PRACTICE

01 · Define the method and rates
Select the address, weight, quantity, and cart range.

02 · Add restrictions or a fee
Hide the method, show an error, or charge a fee.

03 · Check the order process
Verify checkout, invoice, and credit memo.

What does your store gain?

Explore the module features, use cases, and settings.

Advanced Magento 2 shipping rules

Kowal Shipping Rules lets you map your store's real logistics in Magento 2: custom shipping methods, conditional rates, availability restrictions, and additional fees.

Instead of manually correcting orders after purchase, show the customer the right shipping method and cost already during checkout.

Custom shipping methods

Handle pallet, local, oversized, specialized delivery, or other processes specific to your business.

Conditional rates

Build rules based on country, region, ZIP code, cart value, weight, and number of products.

Restrictions and Extra Fee

Hide unavailable options and charge fees for size, packaging, special handling, or a specific method.

One place for shipping logic

Combine methods, conditions, restrictions, and fees into one consistent process. This is especially useful for heavy or non-standard products, delivery zones, and stores with more complex logistics.

How do you implement a rule?

  1. Create a shipping method.
  2. Define the rate and the conditions for applying it.
  3. Add restrictions or an additional fee if needed.
  4. Test cart scenarios and delivery addresses.

FAQ

Can I create my own shipping methods?
Yes. The module is designed to build methods that match your store's real logistics scenarios.

Can rules depend on the address?
Yes, they can include, among other things, country, region, and ZIP code.

Can an additional fee be added?
Yes. Extra Fee can reflect, for example, the cost of packaging, size, or special handling.

Can a method be hidden under specific conditions?
Yes. Restrictions let you limit method availability depending on the rule configuration.

Methods, restrictions, and fees panel

Sales → Shipping Methods & Rules provides Shipping Methods, Shipping Restrictions, and Extra Fees. You enable the kowal_shippingrules carrier in Sales → Delivery Methods, and configure restrictions, fees, and debug in Sales → Shipping Methods & Rules.

Methods can be limited by Store View, customer groups, and conditions. The kowal_shipping_type attribute lets you differentiate product shipping methods and match rates in a mixed cart.

Fee and restriction modes

A restriction can hide a method or replace it with an error and message. Rules have priority and an option to stop further processing.

Extra Fee supports fixed and percent_subtotal, and charging once per cart, per_item, or per_matching_item. Fee tax depends on tax_mode and tax_class_id; amounts pass through quote, order, invoice, and creditmemo.

Diagnostics and checkout implementation

The kowal:shippingrules:stabilization:check command is a check without data modifications. A dedicated log is available in var/log/kowal_shipping_rules.log, and separate switches let you disable restrictions or fees.

The module adds the kowal_shipping_fee totals segment in standard checkout. With Hyvä Checkout and a custom summary, you need to connect its presentation and verify the final amounts.

Migration from Amasty

Normal operation does not require Amasty. The amasty:report and amasty:apply tools support migration of restrictions and Extra Fee through a report, dry-run, and preview.

Saving with --execute includes ready records; manual_review and unsupported remain for analysis. Migration does not disable source modules or switch traffic. Afterward, check the consistency of rules and cart results.

Installation via Composer

Package kowal/module-shipping-rules, module Kowal_ShippingRules. After configuring access to the Kowal repository, install the package, enable the module, update Magento, and clear the cache. In production, include compilation and static content deployment according to your store's process.

From configuration to results

1. Define the method and rates
Select the address, weight, quantity, and cart range.

2. Add restrictions or a fee
Hide the method, show an error, or charge a fee.

3. Check the order process
Verify checkout, invoice, and credit memo.

Shipping for a cart with different item sizes

You mark products with a shipping type and prepare rates for individual types. The method can combine the result as the highest cost, the sum, or the lowest rate.

A conditional fee can reflect additional packaging. You check the final amount for the address, cart, and selected method.

Map your store's shipping rules

Want to adapt the module to your store? Ask about implementing Kowal Shipping Rules and discuss the configuration or required extensions.

More Information

Theme compatibility Luma / Blank, KOWAL

Questions and Answers

Which delivery restrictions and shipping fees can I configure in Magento 2?

Kowal ShippingRules manages shipping methods, delivery restrictions and additional fees in Magento 2. Rules can depend on the cart, products, delivery address and selected shipping method.

Can the module create custom shipping methods?

Yes. It allows you to create shipping methods in Magento Admin and assign rates and availability conditions.

Can shipping methods be hidden?

Yes. The module can hide a shipping method when an order does not meet specified conditions. It can also display a message that the method is unavailable.

Can extra fees be added?

Yes. An extra fee can apply to the whole cart, each product unit or only products that meet the conditions.

Can restriction rules use product attributes?

Yes. Rules can use product attributes, SKU, category, product type, weight, price and other data available in the cart.

Does the module support oversized products?

Yes. This is a main use case. The module can hide unavailable delivery methods and add an oversized transport fee.

Is the module suitable for B2B stores?

Yes. B2B stores often need rules based on cart value, customer groups, delivery regions or product types. The module supports these scenarios.

Can the module replace several separate extensions?

In many cases, yes. Kowal ShippingRules combines shipping method, restriction and additional fee features.

Can store staff work with the module without a developer?

Yes, ongoing rules can be configured in Magento Admin. A developer is mainly needed for deployment, technical testing and any integration with a custom checkout.

Module Installation Instructions

Kowal ShippingRules — installation, configuration, and user guide

Purpose of this document

This document describes the practical implementation and use of the Kowal_ShippingRules module in Magento 2. It is intended for people responsible for module installation, store configuration, implementation testing, and daily management of shipping rules.

The document covers:

  • module installation,
  • basic configuration,
  • creating shipping methods,
  • rate configuration,
  • handling shipping method restrictions,
  • handling additional Extra Fee charges,
  • diagnostics,
  • migration from Amasty modules,
  • a post-implementation test checklist.

Basic information

Technical module name:

Kowal_ShippingRules

Module location:

vendor/kowal/module-shipping-rules

Carrier code:

kowal_shippingrules

The shipping method code in checkout has the following format:

kowal_shippingrules_<kod_metody>

Example:

kowal_shippingrules_dostawa_paletowa

Pre-installation requirements

Before installation, confirm that:

  • the store runs on Magento 2.4.x,
  • the environment uses PHP >=8.1,
  • the Kowal_Base module is available,
  • a backup of files and the database has been made,
  • the implementation is performed first in a test or staging environment,
  • after installation it will be possible to run setup:upgrade and setup:di:compile,
  • the tester has access to the admin panel and checkout.

Module installation

Installation via Composer

You will receive access credentials for the Composer repository (customer email address and license token) by email after purchase. They are also available in the customer panel after logging in at kowal.store. Replace TWOJ_EMAIL_KLIENTA with your account email address and TWOJ_TOKEN with the token you received. Run the commands in the Magento root directory.

composer config repositories.kowal composer https://repo.kowal.store
composer config http-basic.repo.kowal.store 'TWOJ_EMAIL_KLIENTA' 'TWOJ_TOKEN'
composer require kowal/module-shipping-rules

2. Enable the module

bin/magento module:enable Kowal_ShippingRules

If Kowal_Base is not enabled yet, enable it earlier or together with the module:

bin/magento module:enable Kowal_Base Kowal_ShippingRules

3. Update the database

bin/magento setup:upgrade

This command creates the module tables and adds the columns required to support Extra Fee in quote, order, invoice, and creditmemo.

4. Compile DI

In production:

bin/magento setup:di:compile

5. Clear the cache

bin/magento cache:flush

6. Check module status

bin/magento module:status Kowal_ShippingRules

The module should be listed as enabled.

Post-installation check

After installation, run diagnostics:

bin/magento kowal:shippingrules:stabilization:check

Full JSON variant:

bin/magento kowal:shippingrules:stabilization:check --json

The command is read-only and does not change data. It checks, among other things:

  • the presence of module tables,
  • the number of records,
  • invalid conditions JSON,
  • active methods without active rates,
  • Extra Fee rules with tax class when tax mode is disabled.

If the command returns errors, do not switch the module to production use before they are explained.

Basic configuration

Carrier

Path in the Magento panel:

Stores / Configuration / Sales / Delivery Methods / Shipping Methods & Rules

Fields:

  • Enabled — enables or disables the kowal_shippingrules carrier.
  • Title — the method group name visible in checkout.
  • Test Method Name — the name of the test configuration method.
  • Test Method Price — the price of the test configuration method.
  • Sort Order — the carrier order on the shipping methods list.
  • Show Method If Not Applicable — whether to show an error when no methods are available.
  • Displayed Error Message — the message when the method is not available.

Most important setting:

carriers/kowal_shippingrules/active = 1

If the carrier is disabled, methods created in the module will not be available in checkout.

Diagnostics and emergency functions

Path in the Magento panel:

Stores / Configuration / Sales / Shipping Methods & Rules

General Diagnostics section:

  • Enable Debug Logging — saves decision details to the log.
  • Shadow Mode — a mode prepared for comparing behavior during migration.

Restrictions section:

  • Enable Restrictions — enables or disables only restrictions.

Extra Fees section:

  • Enable Extra Fees — enables or disables only additional fees.
  • Fee Tax Mode — defines how tax is handled for Extra Fee.

Available tax modes:

  • Do Not Calculate Tax — the module does not calculate tax on Extra Fee.
  • Calculate by Fee Tax Class — the module calculates tax based on the tax class set on the fee rule.

Default, safe settings:

kowal_shippingrules/general/debug = 0kowal_shippingrules/general/shadow_mode = 0kowal_shippingrules/restrictions/enabled = 1kowal_shippingrules/fees/enabled = 1kowal_shippingrules/fees/tax_mode = none

Path:

Sales / Shipping Methods & Rules

Available sections:

  • Shipping Methods — shipping methods and rates,
  • Shipping Restrictions — shipping method restrictions,
  • Extra Fees — additional fees.

Managing shipping methods

When should you create a shipping method?

Create a shipping method when the store needs its own delivery option, for example:

  • pallet delivery,
  • special transport,
  • local delivery,
  • courier for oversized products,
  • logistics pickup,
  • a method available only for selected products or regions.

Creating a method

Go to:

Sales / Shipping Methods & Rules / Shipping Methods

Then select Add New or edit an existing method.

Typical method fields:

  • Is Active — whether the method is active.
  • Code — the technical method code.
  • Name — the name visible to the customer.
  • Description — the method description.
  • Sort Order — display order.
  • Store Views — store view visibility.
  • Customer Groups — customer group visibility.
  • Conditions — method availability conditions.

Recommendations for the Code field:

  • use lowercase letters,
  • do not use Polish characters,
  • do not use spaces,
  • use underscores instead of spaces.

Examples:

dostawa_paletowatransport_specjalnykurier_gabarytdostawa_lokalna

The full method code in checkout will have the carrier prefix:

kowal_shippingrules_dostawa_paletowa

Method rates

An active method should have at least one active rate. If the method has no matching rate, it will not appear in checkout.

A rate can depend on:

  • country,
  • region,
  • ZIP code,
  • cart value,
  • weight,
  • product quantity,
  • shipping type,
  • priority.

Price modes:

  • fixed — fixed price,
  • percent_subtotal — percentage of subtotal.

Examples:

  • price of PLN 29 for shipments up to 30 kg,
  • price of PLN 149 for pallet delivery,
  • 5% of cart value for special transport,
  • a separate rate for selected ZIP codes.

Method conditions

Conditions define when the method should be available.

Examples:

  • method available only for products from a selected category,
  • method available only for a specific product attribute,
  • method available only for a cart above a specific value,
  • method available only for a selected delivery country.

If conditions are empty, the method is limited only by status, store view, customer group, and matching rate.

Managing shipping method restrictions

When should you use restrictions?

Restrictions are used to hide or block shipping methods that should not be available for a specific order.

Examples:

  • hide parcel locker for oversized products,
  • block international shipping for a selected category,
  • show a message that express transport is unavailable for made-to-order products,
  • hide a delivery method for a selected country.

Creating a restriction

Go to:

Sales / Shipping Methods & Rules / Shipping Restrictions

Then select Add New or edit an existing restriction.

Typical fields:

  • Is Active — whether the restriction is active.
  • Name — internal name.
  • Target Carrier — the carrier the restriction applies to.
  • Target Method — the method the restriction applies to.
  • Action — how it works.
  • Message — customer-facing message.
  • Priority — priority.
  • Stop Processing — whether to stop further rule checking.
  • Store Views — store view scope.
  • Customer Groups — customer group scope.
  • Conditions — matching conditions.

Restriction actions

hide:

  • the method will be hidden,
  • the customer will not see it,
  • good for obvious limitations, e.g. parcel locker for oversized items.

error:

  • the method will be shown as unavailable,
  • the customer will see a message,
  • good when it is worth explaining the reason for unavailability.

Priority and Stop Processing

Rules are checked by priority. Higher priority means earlier checking.

Stop Processing = Yes means that after this restriction matches, the module does not check further restrictions for this method.

Recommendation:

  • use higher priorities for more specific rules,
  • use lower priorities for general rules,
  • enable Stop Processing if the rule should definitively determine method availability.

Managing Extra Fee

When should you use Extra Fee?

Extra Fee is used to add additional charges to an order.

Examples:

  • fee for custom packaging,
  • surcharge for oversized transport,
  • fee for fragile products,
  • logistics fee for a specific delivery method,
  • surcharge for selected regions.

Creating Extra Fee

Go to:

Sales / Shipping Methods & Rules / Extra Fees

Then select Add New or edit an existing fee.

Typical fields:

  • Is Active — whether the fee is active.
  • Name — internal name.
  • Label — the fee name visible in totals.
  • Target Carrier — the carrier the fee applies to.
  • Target Method — the method the fee applies to.
  • Price Type — price type.
  • Price — fee amount.
  • Apply Mode — charging method.
  • Tax Class ID — tax class if tax mode is used.
  • Priority — priority.
  • Stop Processing — whether to stop further fee charging.
  • Store Views — store view scope.
  • Customer Groups — customer group scope.
  • Conditions — conditions for charging.

Price modes

fixed:

  • fixed amount,
  • e.g. PLN 19 for packaging.

percent_subtotal:

  • percentage of cart value,
  • e.g. 3% of order value.

Apply modes

cart:

  • one fee for the entire cart.

per_item:

  • fee multiplied by product quantity.

per_matching_item:

  • fee charged only for products that meet the conditions.

Example:

If the fee for special protection is PLN 5 and the cart contains 3 products that meet the condition, per_matching_item mode will charge PLN 15.

Extra Fee tax

By default, tax on Extra Fee is not calculated:

kowal_shippingrules/fees/tax_mode = none

To calculate tax:

  1. Set Fee Tax Mode to Calculate by Fee Tax Class.
  2. Fill in Tax Class ID on the Extra Fee rule.
  3. Test cart, order, invoice, and creditmemo.

Extra Fee tax should always be checked against the tax configuration of the specific store.

Managing conditions

The module uses a condition builder similar to Magento rules.

Conditions can apply to, among other things:

  • product attributes,
  • SKU,
  • categories,
  • product type,
  • weight,
  • price,
  • cart value,
  • product quantity,
  • delivery country,
  • region,
  • city,
  • ZIP code,
  • coupon,
  • selected shipping method.

Example condition for an oversized product

Assumption:

  • the product has the shipping_type attribute,
  • the value for oversized shipping is pallet.

Rule:

Jeżeli produkt w koszyku ma shipping_type = pallet

Possible actions:

  • show the Dostawa paletowa method,
  • hide parcel locker,
  • add the Transport gabarytowy fee.

Recommendations for working with conditions

  • create a simple rule first and test it in the cart,
  • avoid too many conditions in a single rule,
  • describe rules with clear names,
  • use unambiguous product attributes for important rules,
  • after changing product attributes, test the cart again.

Diagnostics and logging

Dedicated log file:

var/log/kowal_shipping_rules.log

Debug can be enabled in:

Stores / Configuration / Sales / Shipping Methods & Rules / General Diagnostics

Enable:

Enable Debug Logging = Yes

Recommendations:

  • do not leave debug logging permanently enabled in production,
  • enable debug only for the duration of diagnostics,
  • disable debug after testing is complete,
  • analyze logs together with the test cart and rule configuration.

Emergency functions

If a problem occurs after implementation, you can independently disable:

The entire carrier

Stores / Configuration / Sales / Delivery Methods / Shipping Methods & Rules / Enabled = No

Effect:

  • methods from the kowal_shippingrules carrier will not be available.

Only restrictions

Stores / Configuration / Sales / Shipping Methods & Rules / Restrictions / Enable Restrictions = No

Effect:

  • methods will not be hidden or blocked by restrictions.

Only Extra Fee

Stores / Configuration / Sales / Shipping Methods & Rules / Extra Fees / Enable Extra Fees = No

Effect:

  • additional fees will not be charged.

Migration from Amasty

Migration goal

Migration from Amasty is intended to help transfer restriction and extra fee configuration to Kowal_ShippingRules.

The Kowal module does not require Amasty for normal operation. Amasty can be used as a source of migration data and a reference point during testing.

Supported data sources

The migrator analyzes:

amasty_shiprestriction_ruleamasty_extrafeeamasty_extrafee_option

Target tables:

kowal_shipping_restrictionkowal_shipping_fee

Migration safety rules

The migration has been designed cautiously:

  • the report is read-only,
  • dry-run does not save data,
  • apply works as preview by default,
  • saving requires the explicit --execute option,
  • only records with ready status are saved,
  • manual_review and unsupported records are skipped,
  • migration is idempotent thanks to the migration_source and migration_source_key fields,
  • migration does not disable Amasty,
  • migration does not switch traffic automatically.

Step 1 — baseline report

Run:

bin/magento kowal:shippingrules:amasty:report

The report will be saved to:

var/report/kowal_shippingrules_amasty_report.json

The report shows the presence and count of Amasty tables and Kowal tables.

Step 2 — transformation dry-run

Run:

bin/magento kowal:shippingrules:amasty:report --dry-run --limit=100

Dry-run prepares a transformation plan but does not save anything.

Record statuses:

  • ready — the record can be transferred automatically,
  • manual_review — the record requires manual analysis,
  • unsupported — the record is not supported by the automatic migrator.

If the report contains many manual_review or unsupported records, analyze those rules before apply.

Step 3 — preview apply

Run:

bin/magento kowal:shippingrules:amasty:apply --limit=100

This still does not save data. The command shows how many records would be created, skipped, or ended with an error.

Step 4 — apply restrictions

After accepting the preview:

bin/magento kowal:shippingrules:amasty:apply --type=restrictions --limit=100 --execute

The command will save only restrictions with ready status.

Step 5 — apply Extra Fee

After accepting the preview:

bin/magento kowal:shippingrules:amasty:apply --type=fees --limit=100 --execute

The command will save only extra fees with ready status.

Step 6 — post-migration diagnostics

Run:

bin/magento kowal:shippingrules:stabilization:check

Also check the panel:

Sales / Shipping Methods & Rules / Shipping RestrictionsSales / Shipping Methods & Rules / Extra Fees

Step 7 — comparison tests with Amasty

Before disabling or replacing the Amasty configuration, compare results for test carts.

Recommended carts:

  • standard product,
  • oversized product,
  • fragile product,
  • several products with different conditions,
  • order with different delivery countries,
  • order with different ZIP codes,
  • order with a coupon,
  • order with a selected method covered by Extra Fee.

For each cart, check:

  • available shipping methods,
  • hidden methods,
  • error messages,
  • charged extra fee,
  • gross/net amounts if tax fee is used,
  • order,
  • invoice,
  • creditmemo.

Step 8 — switching decision

Only after the results are accepted should you plan the production configuration switch.

Recommendations:

  • do not disable Amasty without a backup,
  • do not delete Amasty data immediately after migration,
  • first disable operation on the configuration side,
  • keep the possibility of rollback,
  • prepare a list of rules that require manual correction.

Rollback after migration

If a problem occurs:

  1. Disable the Kowal ShippingRules carrier.
  2. Disable Enable Restrictions.
  3. Disable Enable Extra Fees.
  4. Restore the previous Amasty configuration.
  5. Check checkout.
  6. Keep migration reports for analysis.

Post-implementation checklist

Technical

  • module:status shows Kowal_ShippingRules as enabled,
  • setup:upgrade completed without errors,
  • setup:di:compile completed without errors,
  • cache:flush completed,
  • stabilization:check returns no errors,
  • the admin panel shows the Shipping Methods & Rules menu,
  • the log file is written when debug is enabled.

Configuration

  • the carrier is enabled,
  • at least one shipping method has been created,
  • the active method has an active rate,
  • store views are set correctly,
  • customer groups are set correctly,
  • restrictions are enabled or intentionally disabled,
  • extra fees are enabled or intentionally disabled,
  • tax mode is consistent with the store's tax configuration.

Checkout

  • the method appears for a cart that meets the conditions,
  • the method does not appear when there is no matching rate,
  • the hide restriction hides the method,
  • the error restriction shows a message,
  • extra fee appears in totals after selecting the method,
  • changing the shipping method recalculates the fee,
  • order contains fee amounts,
  • invoice contains fee amounts,
  • creditmemo correctly refunds the fee.

Common issues

Method does not appear in checkout

Check:

  • whether the carrier is enabled,
  • whether the method is active,
  • whether the method has an active rate,
  • whether the rate matches the country, region, ZIP code, weight, and subtotal,
  • whether the store view is correct,
  • whether the customer group is correct,
  • whether the method conditions are met,
  • whether a restriction is not hiding the method.

Extra Fee is not charged

Check:

  • whether Enable Extra Fees = Yes,
  • whether the fee is active,
  • whether target carrier and target method are correct,
  • whether the fee conditions are met,
  • whether a shipping method has been selected,
  • whether the fee price is greater than zero,
  • whether Stop Processing of an earlier rule has not stopped further charging.

Restriction does not work

Check:

  • whether Enable Restrictions = Yes,
  • whether the restriction is active,
  • whether target carrier and target method are correct,
  • whether the restriction conditions are met,
  • whether the rule priority is correct,
  • whether another rule with Stop Processing does not end processing earlier.

Extra Fee tax is not calculated

Check:

  • whether Fee Tax Mode = Calculate by Fee Tax Class,
  • whether the fee rule has Tax Class ID set,
  • whether the Magento tax configuration returns a tax rate for the address,
  • whether the cart has a delivery address,
  • whether the fee is actually charged.

Best practices

  • Configure simple rules first, then add more conditions.
  • Prepare a test cart for each important rule.
  • Use clear names for methods, restrictions, and fees.
  • Avoid several very similar rules with the same priority.
  • Document the reason for creating a restriction or fee in its name.
  • After changing product attributes, run a checkout test.
  • Enable debug logging only for the duration of diagnostics.
  • Perform migration from Amasty in stages: report, dry-run, preview, execute, QA.

Related documents

  • README.md — technical module description for developers.
  • docs/WDROZENIE.md — detailed implementation documentation and architecture.
  • docs/OPIS_MARKETINGOWY.md — marketing description of the module.
Press to skip carousel

We found other products you might like!

Write Your Own Review
You're reviewing: Shipping Rules, Restrictions and Surcharges for Magento 2
Your Rating:
Quality
Price
Support
loader
Loading...

You submitted your review for moderation.

Related Posts

Will it arrive by Tuesday? How to show an estimated delivery date in Magento 2

Will it arrive by Tuesday? How to show an estimated delivery date in Magento 2

2 min read 1 view

Compare Friday orders placed before and after the dispatch cut-off. Test a holiday, a mixed basket and the date saved with the order.

Read more
Update cookie preferences