How to Create and Manage Magento 2 CMS Blocks?

If you want to share some information, announce special offers or just make your pages more engaging you need Magento CMS blocks. You can create them directly in the admin panel and then display them on different pages of your store.

To go even further you can schedule CMS blocks and display them automatically. But we'll get there later. 

In this article, you'll learn how to create CMS blocks in Magento and how to display them using various methods.

Create CMS Blocks in Magento

Creating Magento CMS blocks is the easiest part. However, let's go through it step by step.

1. Navigate to Content > Elements > Blocks and press the Add New Block button.

2. Enable the CMS Block, and give it a Title and Identifier.

3. Assign your CMS Block to the Store View it should be displayed on.

Magento 2 New CMS Block

4. Create CMS Block Content adding images, videos, links and other content.

Magento 2 Create New CMS Block

Note: you can also press the "Show / Hide Editor" button and insert your HTML code in the text area.

Don't forget to Save a block, once you finish.

If you're comfortable working with code try to create CMS blocks in Magento 2 programmatically

Add CMS Blocks to Different Pages

Since CMS blocks are just content blocks, they won't be displayed on the frontend, even when enabled. There are multiple ways to display Magento CMS blocks on the frontend, depending on where you want to add them.

Admin panel

  • Any page — the best way here is to use widgets since they allow you to choose any location and page (CMS pages, category, blog, etc.).
  • CMS page or blog — to add Magento CMS blocks directly into the CMS page or blog, you can use the widgets feature available in the WYSIWYG editor.
  • Category page — category pages have specific places dedicated to promo blocks, so you can add CMS blocks to a category in the category settings.
  • Checkout success page — the same widget approach applies here, but you can also define conditions under which to display the block on checkout success

Development

If you're a developer, you might also try displaying CMS blocks through PHTML file and XML layout. But note that it requires some technical knowledge. 

So, once you choose the most suitable way to add a CMS block to your Magento 2 pages you can display multiple offers like this:

cms block in magento shopping cart

Display CMS Blocks Dynamically

Although Magento CMS blocks offer a lot of opportunities, there are some downsides. You still need to enable and disable the blocks manually when some of your offers expire.

The solution is Magento 2 Dynamic Blocks and Pages which allows you to display CMS blocks in Magento under different conditions.

Let's take the same "free shipping for orders over $200" offer as an example.

Based on customer groups

For your CMS block to drive the attention of the right audience, you need to target it with the right offer. Therefore, the same block won't work for everybody. To solve this dilemma create unique blocks for each customer group.

e.g. you can offer free shipping only for general customers (those logged in).

magento 2 cms block restrictions for customer group

Based on cart attributes

The "free shipping for orders over $200" block should be displayed for people whose total hasn't passed the $200 threshold. That's when cart attributes come in handy. But subtotal is not the only attribute you can choose.

e.g. you can choose to offer free shipping only to one country

magento 2 cart attributes in conditions

Based on product attributes

If you decide to display a CMS block with some offers on product pages, you can narrow down the options with the product attributes.

e.g. you can display the free shipping offer only on certain categories or only new products.

magento 2 product attributes in conditions

Based on date

Finally, the most important part. To eliminate manual work you need to schedule CMS blocks for certain dates, times and days of the week. The extension automatically disables and enables CMS block based on your settings.

e.g. you can offer free shipping from 8 a.m. to 2 p.m., Monday through Wednesday, during a certain period.

magento dynamic blocks date

CMS block is a powerful tool in your marketing strategy. You just need to make the most of it, using the right approach. 

But don't forget that CMS pages also help to deliver your message. So make sure to display CMS pages dynamically too to reduce the workload.