An Insight Into Taxes And Tax Rules In Magento 2

In this section of this guideline, we will provide a tutorial on how to set up taxes following the locale requirements. Store administrators can set tax classes for products and customer groups, and generate tax rules that combine product and customer classes, tax zones, and rates. Furthermore, there are some advanced topics such as setting up fixed product taxes, compound taxes, and how to display consistent prices across regions, collect a value-added tax.

To define taxes, Magento provides a variety of selections. Tax classes define tax rules, and tax rules are a blend of a Product Class, a Customer Class, a Tax Zone and Rate. Magento also supports the VAT calculation, for b2b transactions in the EU.

Each customer is assigned to a customer class, and each product is assigned to a product class. The shopping cart of each customer will be analyzed, Magento calculates the appropriate tax according to the customer and product classes, and the region.

taxes and tax rules in magento 2
Tax Rules

Step 1: Input the Tax Rule form

On the admin sidebar click Stores. Under Taxes, click Tax Rules. In the upper-right, click Add New Tax Rule. In Tax Rule information, enter a Name and choose the Tax Rate that applies to the rule.

Follow these steps if you need to edit an existing tax rate:

  • Hover to the tax rate, click the Pencil icon
  • Edit the form as you wished and click Save
Taxes and tax rules in magento 2
Tax Rule Information

To enter tax rates, follow one of these methods:

Method 1: Enter Tax Rates Manually

Click Add New Tax Rate, fill the form and click Save

taxes and tax rules in magento 2
New Tax Rate

Method 2: Complete the Additional Settings

Click the Additional Settings and follow these steps:

  1. Select the Customer Tax Class to which the rule applies.
  • To edit a customer tax class, click the Pencil icon to edit the form, then Save it.
  • To generate a new tax class, click Add New Tax Class, fill the form and Save it.
  1. Select the Product Tax Class to which the rule applies.
  • To edit a product tax class, click the Pencil icon to edit the form and click Save.
  • To create a new tax class, click Add New Tax Class, fill the form and click Save.
  1. When more than one tax applies, enter a number into the Priority field to indicate the priority of this tax.
  2. Check the Calculate off Subtotal Only checkbox, if you want taxes to be based on the order subtotal.
  3. Enter a number into the Sort Order field to indicate the order of this tax rule when listed with others.
taxes and tax rules in magento 2
Additional Settings

Click Save Rule after completed

What Inside The Configuration of Magento 2

Every configuration setting in Magento Open Source is  listed as field descriptions in the online Configuration Reference. Read this article to learn how to apply configuration settings to specific store views: An useful information about Scope in Magento 2

Configuration of Magento 2

In this article, we will provide the Configuration Tabs in Magento 2 and how to open every single tab.


Stores > Settings > Configuration > General

This tab contains basic configuration settings for the store, URLs, theme, email addresses, store contacts, currency, editor, and dashboard reports. There are 9 options in this tab: General, Web, Design, Currency Setup, Store Email Addresses, Contacts, Reports, Content Management, New Relic Reporting.


System > Configuration > Catalog

It controls product and inventory settings, controls sitemap and RSS feed generation, and indicates the email template that is used to share products information with friends. There are 5 options in this tab: Catalog, Inventory, XML Sitemap, RSS Feeds, Email to a Friend


System > Configuration > Customers

It controls basic customer account and login options, newsletter settings, wish list, and the format of auto-generated coupon codes. There are 5 options in this tab: Newsletter, Customer Configuration, Wish List, Promotions, Persistent Shopping Cart.


System > Configuration > Sales

It controls checkout and tax settings, payment and shipping options, sales email and PDF print-outs, and Google API settings. There are 10 options in this tab: Sales, Sales Emails, PDF Print-outs, Tax, Checkout, Shipping Settings, Multishipping Settings, Shipping Methods, Google API, Payment Methods.


System > Configuration > Services

It configures Magento API settings, including SOAP and OAuth. There are 2 options in this tab: Magento Web API and OAuth.


System > Configuration > Advanced

It controls default Admin settings, various system configuration settings, advanced module controls, and developer tools. There are 3 options in this tab: Admin, System, Developer.

Above is a full describe the configuration of Magento 2. If you have any question or want to edit the article, feel free to comment. See you in the next article: Inside Taxes of Magento 2.

How To Use A Custom Admin URL in Magento 2

As a security best practice, the default “admin” link or “backend” link is not recommended for your Magento 2 platform web store. Instead of that, you should use custom Admin URL. It will not completely protect your web store from a bad actor, but at least it will avoid to be gain unauthorized access from bad script.

Before executing a custom Admin URL, check with your hosting provider . Some hosting providers require a standard URL to meet firewall protection rules.

In a general Magento installation, the Admin URL and path is under the Magento base URL. The Admin path is one directory under the root.

Default Base URL

Default Admin URL and Path

You can edit the Admin URL and path to another location, however if you have any mistake in editing progress, the access to admin will be removed, and must be fixed from the server. So do not do it by yourself unless you know how to edit configuration files on the server.

Method 1: Change from the Magento Admin

  1. On the Admin sidebar, click Stores. Under Settings, click Configuration. On the left of the panel under Advanced, click Admin
  2. Open the Admin Base URL tap and follow these steps:
  • Uncheck all Use system value checkboxes
  • Set Use Custom Admin URL to “Yes”
  • Input the Custom Admin URL in the following example:

The Admin URL must be in the same Magento installation, and have the same document root as the storefront.

  • Set Custom Admin Path to “Yes”
  • Input the Custom Admin Path. The path that you enter is appended to the Custom Admin URL after the last forward slash: sample_custom_admin
Admin Base URL Custom Admin URL In Magento 2
Admin Base URL
  1. Click Save after completing
  2. Sign out then log back using the new Admin URL and path.

Method 2: Change from the Server Command Line

Use notepad or any text editor to open app/etc/env., edit the name of the [admin] path using lowercase only. Save the file.

Clear cache by System > Tools > Cache Management > Flush Magento Cache. Or delete the content of cache folder in var/cache folder.

Best Way To Configure Store URL In Magento 2

  1. What inside Store URL?

In default Magento installation, each website has a two base URLs. One is assigned to a storefront, and the other one is assigned to the admin. Standard base URLs start with HTTP, and secure base URLs start with HTTPS. To characterize internal links in connection to the base URL, Magento uses variables which allow store owners to move a store from one location to another without updating the links.

Base URL
Secure Base URL
URL with IP address http://###.###.###.###/magento/
  1. Use Secure Protocol

Normally in Magento installation, the base URLs of your store were set up in Web Configuration step. If a security certificate was available, store administrators could determine for secure URL to be used in storefront or admin or both. If multiple stores are included in Magento installation, or if store owners have to add more stores later, they can include the store code in the URL. Store owners can use all Magento resources and operations with a secure protocol.

Magento strongly recommends store administrators to transfer all pages of a production site, including content and product pages with a secure protocol.

Store owners can configure Magento installation to deliver all pages over HTTPS by default. By enabling HTTP Strict Transport Security (HSTS) and fix any insecure page request that is reported by the store, administrators can enhance security. With HSTS protocol, browsers will not render standard HTTP pages that are transmitted with unsecure protocol for the specified domain. When store administrators configured Magento to use secure URLs for both the storefront and Admin, two additional fields display that allow them to enable HSTS.

To configure the base URL, follow these steps:

  • On admin sidebar click Stores. Under Settings, click Configuration.
  • Under General, click Web. Open the base URL tab and follow these steps:

Input Base URL for your store, end with a forward slash so additional URL keys can extend the link from your store. For example:

  • (Optional) To determine an exchange location for the Base URL for Static View Files, enter the path starting with the following placeholder: {{unsecure_base_url}}
  • (Optional) To determine an exchange location for the Base URL for User Media Files, enter the path starting with the following placeholder: {{unsecure_base_url}}
  • For a common installation, it is not necessary to update the paths for the static view files or media files because they are relative to the base URL.
Base URL Configure Store URL In Magento 2
Base URL

Placeholders enclosed in double braces are variables’ markup tags.

  • Save after completed.

Follow these steps to configure the secure base URL:

If security certificate is available in your domain, you can set the URLs of both the storefront and Admin to transfer data over a secure (HTTPS) channel. Your store cannot operate with secure (SSL/TLS) protocol if the security certificate is not available.

  • Open the Base URLs (Secure) tab, and follow these steps:

Input the full Secure Base URL, end with a forward slash. For example:

The Secure Base Link URL field has nothing to change. It is used to generate relative links to the HTTPS base URL.

(Optional) To determine an exchange location for the Secure Base URL for Static View Files, input the path beginning with the following placeholder: {{secure_base_url}}

(Optional) To determine an exchange location for the Secure Base URL for User Media Files, enter the path starting with the following placeholder: {{secure_base_url}}

  • Set these two options to “Yes” to enhance security:

Use Secure URLs on Storefront

Use Secure URLs in Admin

When this fields display, set both options to “Yes” too:

Enhanced Security Settings Configure Store URL In Magento 2
Enhanced Security Settings
  • Click Save after completed

To include the store code in URL, follow these steps:

  • On the admin sidebar click Stores, under Settings click Configuration
  • On the left of the panel, under General, click Web.
  • Edit Add Store Code to your preference.

URL with store code[store-code]/index.php/url-identifier

URL without Store Code

  • Click Save after completed
  • Refresh cache by clicking Cache Management at the top of the workspace


In case there are some pages to be served without HTTPS after configuration, follow these steps:

Change the HTTP base URL to the HTTPS URL.

On the server, edit the .htaccess file (or load balancer) so the unsecure URL is redirected to the secure URL.


A Complete Guideline of Adding Websites In Magento 2

In the same Magento installation, store administrators can set up many websites. The websites can be set up to share the same domain or use different domains. If you want to separate the checkout process of each store under its domain, you have to select a distinct IP and separate Security Certificate for each store. In this article, we will provide a tutorial on adding websites in Magento 2

Multiple Websites Adding websites in magento 2
Multiple Websites

There are two primary steps in adding websites in Magento 2: Create a New Website and Configure the Store URL

Step 1: Create a New Website

On the admin sidebar click Stores > All Stores > Create Website. Follow these steps

Website Information adding websites in magento 2
Website Information
  • Input the domain of new website into a Name text field
  • Input a Code text field that server will use it to point to the domain

The code must start with a lowercase letter(a-z), and can include any combination of letters (a-z), numbers (0-9), and the underscore (_) symbol.

  • Input a sort number to decide the sequence in which this site is listed with other sites. A zero will put the site to the top of the list (Optional)
  • Set Default Store for this website.

Step 2: Configure the Store URL

Read this article to know how to Configure the Store URL

Above is an article about the progress of adding websites in Magento 2 and tutorial on how to create a new website in admin controller. We hope that this article will provide useful information for Magento 2 store administrators to completely handle the basic configuration. In the next article, we will provide a guideline on Store URL and using a custom admin URL. Don’t forget to like and share if you think this article is useful, and subscribe Magestandard for weekly Magento 2 tutorial articles.