When you create CMS blocks in Magento 2 you open a lot of opportunities. CMS blocks allow you to share some information with your customers, announce special offers, sales, and discounts or just make your Magento 2 store pages more interesting and engaging.
Magento enables you to create CMS blocks directly from the admin and show them on different pages of your Magento 2 store via different methods. To go even further you can schedule CMS blocks and display them automatically on different pages.
In this article, you're going to learn more about these methods and how to create CMS blocks in particular.
Follow these steps to create new CMS block in Magento 2:
1. Go to Content > Elements > Blocks and press the Add New Block button.
2. Enable the CMS Block.
3. Set the CMS Block Title and Identifier.
4. Assign CMS Block to the Store View it will be displayed on.
Note: If you're more comfortable working with the HTML code, you can press the "Show / Hide Editor" button and insert your HTML code in the text area.
You can watch this short video to follow the creating of CMS blocks in Magento 2:
That's it, you should now be able to create the CMS block. Yet, you are also free to create CMS blocks in Magento 2 programmatically if this method works better for you. However, in order for it to appear on the storefront, you need to choose the way to show it.
Depending on the information, page, or place you want to add the CMS block to there are different options to:
- display CMS block on Magento 2 category page
- display CMS block via Magento 2 widgets
- insert CMS block into Magento 2 WYSIWYG editor
- call the CMS block using layout XML
- call the CMS block in Magento 2 PHTML file
So, once you choose the most suitable way to add CMS block to your Magento 2 pages you can display multiple offers like this using CMS blocks:
We bet there would be some customers driven by the opportunity to get their products shipped for free.
But the question is: do you really want to enable and disable the CMS blocks every time the special offer period runs out?
Taking into consideration the fact there definitely are some unique offers aimed at different customers you're wondering if it is possible to show different CMS blocks to different customers.
The answer is YES.
Magento 2 CMS Display Rule Extension is exactly what you need. It allows you to run your sales and promotional campaigns easily and effectively. It enables you to choose what customer group, date, weekday and even the exact time of the day corresponding CMS block will be displayed.
There is even more to it.
Let's take the Free Shipping offer as an example. Imagine you've created the CMS block, set it to be displayed the whole week, from 6 a.m to 8 p.m. to General Group of customers which says they will get a free shipping having 200$ cart subtotal.
Honestly, if I've come to buy something for 20$ I won't be interested. But If I intend to purchase something for about 180$ I might want to get it shipped for free if I choose something else to make it 200$.
20$ isn't a big deal if I am already willing to spend 180$, is it?
So, you see that you need some conditions that would define the display of that CMS block to reach the right audience. Magento 2 CMS Display Rules covers that as well.
Except for customer groups, date and time, it allows you to set the conditions based on product or cart attributes. This way no one except for those who fall under conditions will see the CMS block. It significantly simplifies your CMS blocks and pages management.