Skip to content

Load widgets in specific position on category list page – Magento2.4

We would like to create widgets with layout updates and load these widgets in a specific place on the category list page.

So we would like to create a widget from admin, load a CMS static block and then select in the layout updates specific categories to load the CMS static block.

Problem is that in the default widget you can only select a container, but we want to load the CMS static block on a specific position in the category list between the products. To be specific load it after product number 3. So it should be added in the list.phtml template file.

We do know the method to load the CMS static block directly in the list.phml using <?php echo $this->getLayout()->createBlock('MagentoCmsBlockBlock')->setBlockId('block_id')->toHtml();?> but in that case we can not create easily multiple CMS blocks and also can not select it to be dynamic based on the specific category.

We already found the way how to create a custom container inside widgets; https://magento.stackexchange.com/a/147982/16894

How can we achieve this?