Magento shipping methods: Flat Rate, Free Shipping, Table Rates and Matrix Rate
Magento brings three shipping methods that need no carrier account: Flat Rate, Free Shipping and Table Rates. In this lesson we set all three, import a table rates CSV at Website scope, install one free, open-source extension with Composer (WebShopApps Matrix Rate) for several delivery types per country, and check every price in the cart and at checkout. Every command and both CSV files can be copied or downloaded. All prices are example values.
Flat Rate and Free Shipping
In the 2.4.9 admin the shipping methods are under Stores › Configuration › Sales › Delivery Methods. The address your parcels ship from is Shipping Settings › Origin; we set it in Lesson 4. The same page also lists In-Store Delivery, UPS, USPS, FedEx and DHL: those need an account with the carrier.
| Setting | Our value | Note |
|---|---|---|
| Flat Rate › Type | Per Order | The default is Per Item: the price is charged for every item in the cart. |
| Flat Rate › Price | 5.00 | Example value. |
| Free Shipping › Enabled | Yes | |
| Free Shipping › Minimum Order Amount | 100 | Compared with the subtotal after discounts. |
| Free Shipping › Include Tax to Amount | Yes | Our catalog prices include VAT (Lesson 12), so 100 means 100 with VAT. |
| Free Shipping › Show Method if Not Applicable | No | With Yes the method is listed with its error message even when the cart does not qualify. |
| Table Rates › Condition | Weight vs. Destination | Other choices: Price vs. Destination, # of Items vs. Destination. |
Luma sample data: the cart price rule Spend $50 or more – shipping is free! (Marketing › Cart Price Rules) is active after a sample data install. We measured on our 2.4.9 test server that it marks every cart from 50 (without VAT) for free shipping: Free Shipping then shows long before your minimum amount, and Table Rates and Matrix Rate calculate with 0 kg, so they always charge their first weight line. We switched the rule off before recording.
Table Rates and the CSV file
Five columns: country (ISO code), region/state, postcode, the condition value (here: weight and above, in your weight unit) and the price. * means any; a * country line covers every other country.
Country,Region/State,Zip/Postal Code,Weight (and above),Shipping Price GB,*,*,0,4.90 GB,*,*,2,6.90 DE,*,*,0,9.90 DE,*,*,2,12.90 NL,*,*,0,9.90 NL,*,*,2,12.90 *,*,*,0,19.90
Example prices. Edit it in a spreadsheet and save as CSV.
Or create and view it on a server:
cat > tablerates.csv <<'EOF' Country,Region/State,Zip/Postal Code,Weight (and above),Shipping Price GB,*,*,0,4.90 GB,*,*,2,6.90 DE,*,*,0,9.90 DE,*,*,2,12.90 NL,*,*,0,9.90 NL,*,*,2,12.90 *,*,*,0,19.90 EOF
column -s, -t tablerates.csv
The import belongs to a website: switch the admin Scope to Main Website (your website), open Table Rates, use Export CSV to get the current rates in the exact format, choose your file under Import and Save Config. Magento replaces that website’s rates for the selected condition.
Matrix Rate with Composer
WebShopApps Matrix Rate (webshopapps/module-matrixrate) is a free, open-source carrier from ShipperHQ, version 20.5.3, released 22 October 2026, licence OSL-3.0 and AFL-3.0. Like Table Rates it reads a CSV per website, but every line has a delivery type, so one country can get Standard and Express, with weight (or price, or quantity) ranges and optional city and postcode columns. Its composer file sets no PHP or Magento version limits, so we installed and tested it on our Magento 2.4.9 / PHP 8.5 test server before recording.
As the Magento file owner, in the Magento folder (the store runs in production mode):
bin/magento maintenance:enable
composer require webshopapps/module-matrixrate
composer show webshopapps/module-matrixrate | grep -E '^(name|versions|released|license|source)'
bin/magento module:enable WebShopApps_MatrixRate && bin/magento setup:upgrade
bin/magento setup:di:compile
bin/magento setup:static-content:deploy -f en_US en_GB de_DE
bin/magento maintenance:disable && bin/magento cache:flush
bin/magento module:status WebShopApps_MatrixRate
Then as root, because OPcache on our server does not check files for changes (Lesson 1):
systemctl reload php8.5-fpm
Matrix Rate settings and CSV
Delivery Methods now has WebShopApps Matrix Rate (it starts with a ShipperHQ box about their paid service; the settings are below). Default Config: Enabled Yes, Title Parcel (shown above the delivery types), Condition Weight vs. Destination, Save Config. Then Scope Main Website, Import the file, Save Config.
Country,Region/State,City,Zip/Postal Code From,Zip/Postal Code To,Weight From,Weight To,Shipping Price,Delivery Type GB,*,*,*,*,0,10,3.95,Standard GB,*,*,*,*,10,*,7.95,Standard GB,*,*,*,*,0,*,8.95,Express DE,*,*,*,*,0,10,6.95,Standard DE,*,*,*,*,10,*,11.95,Standard DE,*,*,*,*,0,*,14.95,Express NL,*,*,*,*,0,10,6.95,Standard NL,*,*,*,*,10,*,11.95,Standard NL,*,*,*,*,0,*,14.95,Express
Columns: Country, Region/State, City, Zip/Postal Code From, Zip/Postal Code To, Weight From (exclusive), Weight To (inclusive), Shipping Price, Delivery Type. * in Weight To = no upper limit. Example prices.
cat > matrixrates.csv <<'EOF' Country,Region/State,City,Zip/Postal Code From,Zip/Postal Code To,Weight From,Weight To,Shipping Price,Delivery Type GB,*,*,*,*,0,10,3.95,Standard GB,*,*,*,*,10,*,7.95,Standard GB,*,*,*,*,0,*,8.95,Express DE,*,*,*,*,0,10,6.95,Standard DE,*,*,*,*,10,*,11.95,Standard DE,*,*,*,*,0,*,14.95,Express NL,*,*,*,*,0,10,6.95,Standard NL,*,*,*,*,10,*,11.95,Standard NL,*,*,*,*,0,*,14.95,Express EOF
column -s, -t matrixrates.csv
Check the imports
A quick look at both tables (as root; magento is our database name):
mariadb magento -e "SELECT dest_country_id AS country, condition_value AS kg_from, price FROM shipping_tablerate WHERE website_id = 1 AND condition_name = 'package_weight'"
mariadb magento -e "SELECT dest_country_id AS country, condition_from_value AS kg_from, condition_to_value AS kg_to, price, shipping_method FROM webshopapps_matrixrate"
Our result: 7 table rate rows (country 0 is the * line) and 9 Matrix Rate rows (a * in Weight To is stored as 10,000,000).
Cart and checkout
On the storefront: the MageBooster Travel Mug from Lesson 10 (24.00, 0.4 kg), then the cart’s Estimate Shipping and Tax. What our test store showed with the example files:
| Cart | Country | Parcel (Matrix Rate) | Best Way (Table Rate) | Flat Rate | Free Shipping |
|---|---|---|---|---|---|
| 1 mug, 24.00, 0.4 kg | United Kingdom | Standard 3.95 · Express 8.95 | 4.90 | 5.00 | not shown |
| 1 mug, 24.00, 0.4 kg | Germany | Standard 6.95 · Express 14.95 | 9.90 | 5.00 | not shown |
| 5 mugs, 120.00, 2 kg | Germany | Standard 6.95 · Express 14.95 | 12.90 | 5.00 | 0.00 |
The checkout’s shipping step lists the same methods and prices. Cart and checkout pages are not cached by Varnish, so new rates show at once; after changing settings, a bin/magento cache:flush never hurts.
Downloads
#!/bin/bash # MageBooster Lesson 15: shipping methods in Magento 2.4.9 + the free Matrix Rate extension. Run the parts one by one on the server. # 1) The table rates file (or download tablerates.csv), then import it in the admin at Website scope cat > tablerates.csv <<'EOF' Country,Region/State,Zip/Postal Code,Weight (and above),Shipping Price GB,*,*,0,4.90 GB,*,*,2,6.90 DE,*,*,0,9.90 DE,*,*,2,12.90 NL,*,*,0,9.90 NL,*,*,2,12.90 *,*,*,0,19.90 EOF column -s, -t tablerates.csv # 2) Install Matrix Rate (as the Magento file owner, in the Magento folder; production mode) cd /var/www/magento bin/magento maintenance:enable composer require webshopapps/module-matrixrate composer show webshopapps/module-matrixrate | grep -E '^(name|versions|released|license|source)' bin/magento module:enable WebShopApps_MatrixRate && bin/magento setup:upgrade bin/magento setup:di:compile bin/magento setup:static-content:deploy -f en_US en_GB de_DE # your admin + store view locales bin/magento maintenance:disable && bin/magento cache:flush bin/magento module:status WebShopApps_MatrixRate # as root: OPcache without timestamp checks needs a PHP-FPM reload (your PHP version) systemctl reload php8.5-fpm # 3) The Matrix Rate file (or download matrixrates.csv), then import it in the admin at Website scope cat > matrixrates.csv <<'EOF' Country,Region/State,City,Zip/Postal Code From,Zip/Postal Code To,Weight From,Weight To,Shipping Price,Delivery Type GB,*,*,*,*,0,10,3.95,Standard GB,*,*,*,*,10,*,7.95,Standard GB,*,*,*,*,0,*,8.95,Express DE,*,*,*,*,0,10,6.95,Standard DE,*,*,*,*,10,*,11.95,Standard DE,*,*,*,*,0,*,14.95,Express NL,*,*,*,*,0,10,6.95,Standard NL,*,*,*,*,10,*,11.95,Standard NL,*,*,*,*,0,*,14.95,Express EOF column -s, -t matrixrates.csv # 4) Check both imports (as root, database "magento"; use your own database name/login) mariadb magento -e "SELECT dest_country_id AS country, condition_value AS kg_from, price FROM shipping_tablerate WHERE website_id = 1 AND condition_name = 'package_weight'" mariadb magento -e "SELECT dest_country_id AS country, condition_from_value AS kg_from, condition_to_value AS kg_to, price, shipping_method FROM webshopapps_matrixrate"
#!/bin/bash # MageBooster Lesson 15: the Default Config shipping settings of the lesson, from the command line instead of the admin. # The CSV imports are admin-only (Stores > Configuration > Sales > Delivery Methods, scope Main Website). cd /var/www/magento sudo -u magento bin/magento config:set carriers/flatrate/active 1 sudo -u magento bin/magento config:set carriers/flatrate/type O # O = Per Order, I = Per Item (default) sudo -u magento bin/magento config:set carriers/flatrate/price 5.00 sudo -u magento bin/magento config:set carriers/freeshipping/active 1 sudo -u magento bin/magento config:set carriers/freeshipping/free_shipping_subtotal 100 sudo -u magento bin/magento config:set carriers/freeshipping/tax_including 1 sudo -u magento bin/magento config:set carriers/freeshipping/showmethod 0 sudo -u magento bin/magento config:set carriers/tablerate/active 1 sudo -u magento bin/magento config:set carriers/tablerate/condition_name package_weight # or package_value_with_discount, package_qty sudo -u magento bin/magento config:set carriers/matrixrate/active 1 sudo -u magento bin/magento config:set carriers/matrixrate/title Parcel sudo -u magento bin/magento config:set carriers/matrixrate/condition_name package_weight sudo -u magento bin/magento cache:clean config
Troubleshooting
| Symptom | Cause and fix |
|---|---|
| Free Shipping shows below your minimum amount; table or matrix rates never change with weight | A cart price rule with free shipping is active (Luma sample data: “Spend $50 or more – shipping is free!”). Switch it off in Marketing › Cart Price Rules. |
| No Import / Export for Table Rates or Matrix Rate | They only appear at Website scope: change the Scope switcher to your website. |
| Import error “Please correct … in Row #” | Check the column count, ISO country codes (DE, not Germany), region codes and decimal points. Export CSV first and keep its format. |
| A method is missing for a country | No CSV line matches that country and weight, or Ship to Applicable Countries limits it. Add a * country line as a fallback. |
| Flat Rate is much higher than expected | Type is Per Item (the default): the price is multiplied by the number of items. |
| The admin or storefront looks broken after the install | Production mode: run setup:di:compile and setup:static-content:deploy for your locales, then flush the cache and reload PHP-FPM. |
Next lesson
Lesson 16: Store languages: English, Turkish and German store views.
▶ Watch every MageBooster lesson on YouTube: all lessons in order · subscribe to the channel
