digitalmarketing and seo
Slide 1

We Designed for

Web Development
Image is not available

In the dynamic landscape of digital presence, harnessing the power of effective web development is paramount. At TAG VIBE....

Slide 2

We Designed

App Development
Image is not available

In today's mobile-centric world, having a mobile app is essential for reaching and engaging with your
audience....

Slide 3

We Designed

Digital Marketing & Search Engine Optimization
Image is not available

we great to do digital marketing and search engine optimization work as per google rule and regulation....

previous arrowprevious arrow
next arrownext arrow

How to apply custom updates to product/category pages

Spread the love

To apply custom updates to product/category pages in Magento 2, there are several solutions you can use depending on your specific needs. Here are a few examples:

Use Layout XML Updates
You can use Layout XML Updates to apply custom updates to product/category pages in Magento 2. This solution allows you to modify the layout of the page by adding or removing blocks, changing block attributes, and more. Here is an example of how to add a custom block to the product page:

<referenceBlock name="product.info.main">
   <block class="Magento\Framework\View\Element\Template" name="custom.block" template="Vendor_Module::custom_block.phtml"/>
</referenceBlock>


In this example, we are adding a new block called “custom.block” to the “product.info.main” block on the product page. The block uses a custom template called “custom_block.phtml”, which should be located in the “Vendor_Module” module.

Use CMS Static Blocks
Magento 2 also allows you to create CMS static blocks and apply them to product/category pages. This solution is useful if you want to add custom content or promotions to a specific page without modifying the layout. Here is an example of how to add a CMS static block to the category page:

Go to Content > Elements > Blocks in the Magento Admin Panel.

Create a new static block with your custom content.

Go to Products > Categories and select the category you want to add the block to.

Go to the Content tab and add the following code to the “Display Settings” field:

{{block class="Magento\Cms\Block\Block" block_id="your_block_id"}}


In this example, “your_block_id” is the ID of the CMS static block you created.

Use Theme Customization
If you want to apply custom updates to multiple pages or make more extensive modifications to the layout, you can use Magento 2’s built-in theme customization features. This solution involves creating a child theme of your current theme and making modifications to the theme’s files. Here is an example of how to add a custom block to the product page using theme customization:

Create a child theme of your current theme.

Copy the “catalog_product_view.xml” file from your parent theme to your child theme’s “Magento_Catalog/layout” folder.

Add the following code to the “catalog_product_view.xml” file:

<referenceBlock name="product.info.main">
   <block class="Magento\Framework\View\Element\Template" name="custom.block" template="Vendor_Module::custom_block.phtml"/>
</referenceBlock>


In this example, we are adding a new block called “custom.block” to the “product.info.main” block on the product page. The block uses a custom template called “custom_block.phtml”, which should be located in the “Vendor_Module” module.

These are just a few examples of how to apply custom updates to product/category pages in Magento 2. Depending on your specific needs, there may be other solutions available as well.

Scroll to Top