Breadcrumbs

Home Web Development Setting up Table Rates on Magento 2 | Magento Shipping | Magento Table Rates
Setting up Table Rates on Magento 2 | Magento Shipping | Magento Table Rates PDF Print E-mail
Written by Tom   

Setting up a custom table rate in Magento 1.x or Magento 2.x is not as simple as uploading your table rate CSV file in Store>Configuration>Sales>Shipping Methods.

 

You first need to update the database table for region then upload and figure your Magento Admin. Follow the below steps to setup table rate in shipping methods.

 

1. Access your Magneto websites database in MySQL.

 

2. Search and find the tables directory_country_region table and directory_country_region_name

 

3. Open the table: directory_country_region

 

// insert regions into directory_country_region table

 

INSERT

INTO `your-database-name`.`directory_country_region`

(`region_id`, `country_id`, `code`, `default_name`)

VALUES

(NULL, 'AU', 'VIC', 'Victoria'),

(NULL, 'AU', 'NSW', 'New South Wales'),

(NULL, 'AU', 'QLD', 'Queensland'),

(NULL, 'AU', 'ACT', 'Australian Captial Territory'),

(NULL, 'AU', 'NT', 'Northern Territory'),

(NULL, 'AU', 'WA', 'Western Australia'),

(NULL, 'AU', 'SA', 'South Australia'),

(NULL, 'AU', 'TAS', 'Tasmania');

 

 

4. Open the table: directory_country_region_name:

 

// make sure the region ID is updated to the respective region ids in directory_country_region. This means replace the ('en_AU', '***', 'Victoria'), with the region ID ~ *** with 512 ('en_AU', '512', 'Victoria'),

 

INSERT

INTO `your-database-name`.`directory_country_region_name`

(`locale`, `region_id`, `name`)

VALUES

('en_AU', '***', 'Victoria'),

('en_AU', '***', 'South Australia'),

('en_AU', '***', 'Western Australia'),

('en_AU', '***', 'Northern Territory'),

('en_AU', '***', 'Queensland'),

('en_AU', '***', 'New South Wales'),

('en_AU', '***', 'Australian Capital Territory'),

('en_AU', '***', 'Tasmania');

 

For example:

 

INSERT

INTO `your-database-name`.`directory_country_region_name`

(`locale`, `region_id`, `name`)

VALUES

('en_AU', '512', 'Victoria'),

('en_AU', '518', 'South Australia'),

('en_AU', '517', 'Western Australia'),

('en_AU', '516', 'Northern Territory'),

('en_AU', '514', 'Queensland'),

('en_AU', '513', 'New South Wales'),

('en_AU', '515', 'Australian Capital Territory'),

('en_AU', '519', 'Tasmania');

 

 

 

5. Login in the Magento Admin and navigate to Store>Configuration>Sales>Shipping Methods

 

 

6. Scroll to Table Rates select Enable: Yes. Save Config

 

 

 

7. Scroll to top of page, from Store View click the dropdown Default Config select Main Website for Default Store View

 

 

8. Scroll back down to Table Rates, click Export CSV.

 

9. Open the CSV file in Excel and enter the rates as below.

 

// table rate CSV example:

 

"Country","Region/State","Zip/Postal Code","Order Subtotal (and above)","Shipping Price"

"AU","VIC","*","1","35"

"AU","NSW","*","1","50"

"AU","SA","*","1","60"

"AU","QLD","*","1","60"

"AU","ACT","*","1","50"

"AU","NT","*","1","70"

"AU","WA","*","1","70"

"AU","TAS","*","1","60"

 

 

Save the CSV

 

7. Click the Import button and import the file. Click Save Config.

 

 

8. Clear Cache.

 

 

This should setup the Table Rates by state and the state drop should now be shown in the Magento front end. Info derived from Git Hub.