How to enable table rates in Magento 2 with CSV file example?
Say, your warehouse is located in Los Angeles, California. It’s cheaper for you to ship an order to San Francisco, California, than to New York City. So you can use table rate to determine shipping costs basing on the following combinations:
- Weight v. Destination
- Price v. Destination
- Number of Items v. Destination
In this article, we will consider how to configure table rates as a shipping method, import CSV, and show you an example of a table. Let’s start.
Helpful tip: Do you want to use more complex dependencies between address, cart weight, and volume, order subtotal, and price? Take a look at the Amasty Shipping Table Rates extension. It allows you to create an unlimited number of custom shipping methods and rate combinations, define special fees for extra-large or fragile products, show shipping method comments and labels on the frontend.
Table rates settings
To start using table rates, do the following steps:
- Go to Stores > Settings > Configuration, then open the Sales tab and click on the Shipping Methods.
- Go to the Table Rates section and choose Yes in the Enabled field.
- Enter the Title and Method Name that you want to display on the frontend.
- Choose the calculation method in the Condition filed.
- Select Yes in the Include Virtual Products in Price Calculation field if you want to add virtual products to the calculation.
- Set up a handling fee in the Calculate Handling Fee and Handling Fee fields, if needed.
- Enter the message that you want to display in case the method is unavailable in the Displayed Error Message field.
- Choose countries for what the shipping method will be available in the Ship to Applicable Countries field.
- Enter the Sort Order of the shipping method and save the changes.
- Then you need to configure the CSV file. For this, you should choose the needed Store View, and click on the Export CSV button.
- Download the shipping table rates file on your computer, open it, and fill in the table with the needed values. Check how to complete the table in the official guide.
- When you are ready, save the file, and return to the Table Rates section.
- Double-check the Store View setting in the left corner. Next, find the Import field and click on the Choose File button.
- Import the needed file from your computer, and save the configurations.
- Go to the frontend and test the result.
Table rates example
Say, your shipping rate depends on the cart subtotal and state where you are shipping. For states where you have warehouses, you have preferential rates. In this case, you will use the Price v. Destination condition.
In the table below, you can see how the shipping fee changes according to cart subtotal for all the orders with shipping region California (CA) and Utah (UT):
|COUNTRY||REGION / STATE||ZIP / POSTAL CODE||ORDER SUBTOTAL (and above)||SHIPPING PRICE|
The shipping price is lower for these states than for the rest of the country and varies from $5 to $15. The symbol * represents all values i.e. if we put * in the Zip Code column, that means we want to use this rule for all the addresses of this region.