[Admin guide] Inactive & Blocked Customers Feature
How does it work?
Inactive tag
If a customer is tagged Inactive, that customer cannot use the site at all. The customer will see this message: “Please reach out to Maileg to have your account reactivated.”
2. Blocked tag
If a customer is tagged Blocked, that customer has full access to the site and places an order but their order can't be processed.
The blocked customer will see this message: “Your account is currently past due. You may continue to use the site but your orders will not be processed until you contact accounting.”
3. To find those tags
Go to Admin → Customer → choose the customer you want → add tags
To enable the feature
Inactive customers
Go to Admin → Online Store → Themes → Edit code → Layout folder → theme.liquid file
In the theme.liquid file, you will find the <main> tag in the <body> tag
This <main> tag is working to render the content layout of the site.
Now add a display condition to the <main> tag to enable the Inactive tag as below.
{% if customer.tags contains "Inactive" %}
{% else %}
<main id="MainContent" class="content-for-layout focus-none" role="main" tabindex="-1">
{{ content_for_layout }}
</main>
{% endif %}
After that, If customer tags contain “Inactive”, nothing will be displayed.
3. To add the message
Depending on where we want to display the message, we will create a tag in the corresponding position in the code.
In this case, you want it to show the message “Please reach out to Maileg to have your account reactivated.” in the Menu section.
a. Create message
Go to Admin → Online Store → Themes → Edit code → Locales → en.default. json → Find “customer"
"customer": {
"label": {
"blocked": "Your account is currently past due. You may continue to use the site but your orders will not be processed until you contact accounting.",
"inactive": "Please reach out to Maileg to have your account reactivated."
},
⇒ Shortcut 'customer.label.inactive'
b. Display message when Blocked
Go to Admin → Online Store → Themes → Edit code → Snippets folder → header-dropdown-menu.liquid file
Header-dropdown-menu.liquid This file will help in rendering the dropdown menu.
In this file, we will also add display conditions
{% if customer.tags contains "Inactive" %}
<div style="text-align: center; background: #b2a8a0; padding: 1rem; font-size: 20px; color: #fff; grid-column: 1 / 5;">
<span>{{ 'customer.label.inactive' | t }} </span>
</div>
{% else %}
← dropdown menu content →
{% endif %}
<span>{{ 'customer.label.inactive' | t }} </span>
This <span> tag will contain our message. Here, I replace the message with key {{ 'customer.label.inactive' | t }}.
To translate the message to multiple languages, you can find the guidelines here
—> [User guide] Translation location - Maileg Wholesale
If customer tags contain “Inactive”, the message will be displayed while the menu will be hidden.
Blocked Customer
With blocked customers, they still have the right to use the website, so this section will only focus on how to add the message.
The admin >> don't process their order
This message shows the customer that they can't process any order but view the website.
To add the message
Go to Admin → Online Store → Themes → … button (next to the Customize button) → Edit code → Snippets folder → header-dropdown-menu.liquid file
We will also add the condition to display it in the header-dropdown-menu.liquid file, and place this code at the end of the file.
{% if customer.tags contains "Blocked" %}
<div style="text-align: center; background: #b2a8a0; padding: 1rem; font-size: 20px; color: #fff; grid-column: 1 / 5;">
<span>{{ 'customer.label.blocked' | t }} </span>
</div>
{% endif %}
If customer tags contain “Blocked”, the message will be displayed.
To disable the feature
To disable the Inactive tag: In the Theme.liquid file: remove {% if %} {% endif %} and keep the <main> tag with its content.
To disable the Blocked tag: In the Header-dropdown-menu.liquid file: remove {% if %} {% endif %} while making sure the <nav> tag is still at the end of the file.