Magento 2 CMS Block Targeting by Customer Group, Country and Store View
SKU: CMSBLOCKCUSTOMERGROUP1
- serve CMS blocks by customer group, store view, country and login status
- show-if and hide-if rules per block
- fallback block and preview as group and country
- cache context without an external geo service
Einmaliger Kauf · inkl. 12 Monate Updates · zzgl. MwSt.
Magento 2 CMS Block Targeting: the right content for every visitor
Trade buyers need different notices than consumers, guests different ones than regular customers, visitors from Austria different ones than from Germany. With the Mironsoft Magento 2 CMS block targeting you define per block who should see it. The blocks remain ordinary CMS blocks and are still embedded via layout, widgets and Page Builder. The module works in the Hyvä theme without an additional library.
Customer group
A block applies to one or several customer groups, including logged-out guests.
Store view
Limit a block to single store views without creating it several times.
Country
Rules by country: for customers from the shipping or billing address, for guests from a header set by your CDN or server.
Login status
Distinguish logged in and logged out, for example for registration prompts or account notices.
Show or hide
Per rule you choose whether the block appears for the group or disappears for it.
Fallback block
Whoever does not meet the rule gets another block instead of a gap.
Why Magento 2 CMS block targeting makes sense
Many shops serve several audiences with one catalog. The trade buyer should see the tier price information, the consumer the shipping discount, the guest the welcome voucher. Magento itself has no audiences for CMS blocks, so many shops resort to duplicate pages, theme code or customer-group categories.
Magento 2 CMS block targeting moves this decision into the admin. Marketing creates blocks, selects audiences and needs neither developers nor a deployment. Each piece of content stays a single block with a clear name instead of vanishing in branching templates.
Magento 2 CMS Block Targeting: define rules per block
You find Magento 2 CMS block targeting in the CMS block as the tab Audience. There you select customer groups, store views, countries and login status and decide whether the rule shows or hides the block. The module combines several conditions with and, and values within one selection with or. Without a rule the block stays visible to everyone as before, so existing blocks do not change.
- Customer group, store view, country and login status combinable
- Show-if or hide-if per block
- Blocks without a rule stay visible to everyone
Magento 2 CMS Block Targeting country rules without an external geo service
For logged-in customers Magento 2 CMS block targeting takes the country of the shipping or billing address, depending on the setting. For guests it reads a header that your CDN or web server already sets, for example a country header. There is no query to an external service, and IP addresses are not stored. If the header is missing, the behavior you define applies: show the block, hide it or use the fallback.
- Country from the address of logged-in customers or from a header for guests
- No external service queries, no stored IP addresses
- Behavior for a missing country configurable
Magento 2 CMS Block Targeting: fallback block and preview
If a visitor does not meet the Magento 2 CMS block targeting rule, a fallback block can appear, for example the general banner instead of the trade notice. With the preview you view the page as if you were in a certain customer group and country. The preview is available only to logged-in admin users and changes no data. An overview lists all blocks with rules.
- Fallback block instead of an empty area
- Preview as customer group and country, admin login only
- Overview list of all blocks with rules
Cache and performance of Magento 2 CMS Block Targeting
The Magento full page cache already varies by customer group. For country rules the module adds the country to the cache context for Magento 2 CMS block targeting, but only the countries your rules actually use; all others fall into one group. The number of cache variants stays small, and pages are still delivered fast. When you change a rule, the module renews the cache tags of the affected block.
- Customer group uses the existing cache context
- Only used countries form their own cache variants
- Rule changes renew the block cache tags precisely
Where Magento 2 CMS block targeting helps in daily shop work
Typical situations in which a block should not be the same for everyone.
Trade and retail customers
Tier price notice and minimum quantities only for the trade group, a shipping offer for consumers.
Encouraging registration
Guests see a block with registration benefits, logged-in customers the hint about their account.
Country-specific notices
Customs and shipping information appears only for visitors to whom it applies.
Several store views
A block meant for one language or market is not created several times.
Magento 2 CMS Block Targeting: without and with the module
The difference to duplicate pages and theme code.
| Topic | Without the module | With Mironsoft CMS Block Targeting |
|---|---|---|
| Audiences | Duplicate blocks or theme code | Rules per block in the admin |
| Country | Custom development | Country rule with header source |
| Maintenance | Developer required | Marketing maintains it |
| Preview | With test accounts | Preview as group and country |
| Cache | Often disabled or error-prone | Context only for rules in use |
How we set up your Magento 2 CMS Block Targeting
The process after your order.
Briefing
You tell us customer groups, countries and the blocks to be targeted.
Installation
We install Magento 2 CMS block targeting and clarify where the country for guests comes from, for example the CDN header.
Rules
Together we create the first rules and fallback blocks.
Testing
We test guest, trade buyer and regular customer, country changes, missing country data and the page cache.
Handover
Your team gets an introduction to rules, preview and overview.
Differences to scheduling, page access and product restriction
The Mironsoft CMS Block Scheduler switches blocks by time. The CMS page restriction regulates access to whole pages, the product restriction by customer group concerns products, and the country store switcher routes visitors to matching store views. Magento 2 CMS block targeting, by contrast, selects single blocks by audience.
The modules can be combined, for example a trade banner only in December. The output remains ordinary block output, without jQuery and without an additional library.
No download, personal setup instead
CMS Block Targeting is not listed here as a ready-made download file for self-installation. The purchase is a service commission: we get in touch after the purchase, install the module in your shop and agree on rules, country source and fallbacks together with you.
Frequently asked questions
Everything important about rules, country, cache and how the purchase works.
How can I show a CMS block only to one customer group in Magento 2?
How can I hide a CMS block for guests in Magento 2?
How can I show a CMS block by country in Magento 2?
Is an external geo service queried?
What happens if the country is unknown?
Does the page cache stay active?
Can I combine several conditions?
Does Magento 2 CMS block targeting work with Hyvä?
How does this differ from the CMS Block Scheduler?
Can I download and install the module myself?
Magento 2 CMS Block Targeting – Mironsoft