Static Blocks in Magento 2 are used to display information in different places in your store. For example, a discount block or ‘Contact Us’ block can be used in different locations of your website to display relevant information.
Static Blocks can be a very powerful tool, as you can manage different HTML content for different pages from the static blocks section in the backend.
In this tutorial, we’ll guide you through the process of adding a new block in Magento 2.
Step 1: Go to Content => Blocks (under Elements)
You’ll see a list of all the blocks that you already have in your store.
You can edit or delete a particular block by selecting the block and choosing Edit or Delete from the Action drop-down list.
Step 2: To add a new block, click on the Add New Block button.
You’ll be shown a New Block form.
Fill in the following details in the New Block form:
- Enable Block: Set this to “Yes” if you want to allow the new block to be added to other pages.
- Block Title: Set title for your new block.
- Identifier: Set a unique identifier for your new block.
- Store View: Select the store view for which you want the page (on which you’ll add this block) to be visible.
- WYSIWYG Editor: Use the what-you-see-is-what-you-get-editor to edit the content of the new static block.
Step 3: Once you’re done filling out the New Block form, click the Save Block button.
This will save and add your new block to your Magento 2 store backend.
This concludes our tutorial on how to add blocks in Magento 2.
You can include static blocks in templates, category pages or CMS pages. You can also include static blocks in other blocks using Widgets in Magento 2.