The topic of shipping is so huge that you could write a book about it. The options related, for example, to width, length and height, breakable, edible, and so on, are endless.
After configuring these attributes for a product, we can start relating them to our shipping setup and shipping vendor. Magento has a huge selection of shipping vendors to choose from. It's important to choose the right vendor and the correct Magento extension. This could be challenging. Do not immediately pick the cheapest shipping vendor. Check the quality of their service, their specialty when it comes to shipping your products, and their Magento extension.
Creating the correct tax rules is not for the fainthearted. Are you in the USA, Europe, Asia, or somewhere else? Every country has its own tax rules. Always check with the local authorities to find out which rules to apply.
To step through this recipe, you will use a Droplet created in Chapter 2, Magento 2 System Tools at DigitalOcean https://www.digitalocean.com/. We will be using an NGINX, PHP-FPM, Composer-based setup including sample data. No other prerequisites are required.
For the purpose of this recipe, let's assume that we need to create shipping and tax rules for the European Union. The shipping rules apply to a Table Rates
setup using a local shipping vendor. The following steps will guide you through them.
Now complete the entire field set related to your company. This is the starting point. When using the Shipping Policy, just mark it Yes and commit your policy. Here is an example of how a policy could look:
Since the scope of this recipe is Table Rates, using Free Shipping and Flat Rate is pretty straightforward.
Now click on the Table Rates drop-down arrow, and commit the following information:
In the Condition drop-down menu we use the Weight vs. Destination option. Beside this option we also can choose from Price vs. Destination or # (number) of items vs. Destination. Depending on your needs, pick one of them. Since we are using the Weight option, we need to make sure that our entire product set has the correct weight configured.
tablesrates.csv
that we need to complete. Download the file and open up a spreadsheet editor, such as MS Excel, OpenOffice Calc, or Google Docs Spreadsheet.Since we are using the Weight vs. Destination option, the CSV schema looks as follows:
Country |
Region/State |
Zip/Postal Code |
Weight (and above) |
Shipping Price |
---|---|---|---|---|
NLD |
* |
* |
0 |
6.95 |
NLD |
* |
* |
50 |
9.95 |
NLD |
* |
* |
100 |
14.50 |
DEU |
* |
* |
0 |
10.50 |
DEU |
* |
* |
50 |
17.50 |
DEU |
* |
* |
100 |
22.50 |
FRA |
* |
* |
0 |
10.50 |
FRA |
* |
* |
50 |
17.50 |
FRA |
* |
* |
100 |
22.50 |
In this example, we use a wildcard for the Region/State and Zip/Postal Code. You can replace this wildcard with the appropriate value. Upload your saved tablesrates.csv
file in the Import section and click Save Config, and clean the cache:
50
and click Save & Close. Do the same for Strive Shoulder Pack (49
) and Crown Summit Backpack (51
). Your product grid should now look as follows:We only used German, French, and Dutch codes in this example. If you want to have your country shipping fees in the Table Rate CSV file, update them accordingly:
EU Customers
. Now let's select all the EU countries with the (standard) tax Rate and click Save Rule:In this example we set the default rule to the high tax rate. Create a new rule when you are selling services or products that have a lower tax rate. But don't forget to create a new Product Tax Class in the Additional Settings. This class can then be used in every product type where it applies.
Let's recap and find out what we did throughout the preceding recipe. In Steps 1 through 10, we configured a shipping method called Table Rates to handle all the shipping. We used the Weight vs. Destination option. Using this option we needed to update all our products with the correct weight attribute value.
In Steps 12 through 18, we configured tax rules for the European Union using a tax_rates.csv file from GitHub. By using this file, it was easy to configure the appropriate tax rule. In Step 15, we gave an example of how a system configuration for a store view could look.
Depending on where you live or are sending products to, using the correct measuring units in Magento 2 is important. This new feature helps us to configure whether we calculate the weight in lbs (pounds) or kgs (kilograms). We can find this new option in Stores | Configuration | General | Locale Options. Here is an example showing the Weight Unit field:
3.133.134.151