I want to Update XML using observer on Product Page when page load.
I want to set there condition with product Attribute there.
How can I do that?
Magento2 – Update Layout Using Observer on Product Page
event-observerlayoutmagento2product-pagetheme
Best Answer
What you can do is add layout via event layout_load_before, you can use this event to add your dynamic layout.
Here is sample code for you.
[Vendor]/[Module]/etc/events.xml
In your [Vendor][Module]\Observer\LayoutLoadBefore.php file write below code
Create layout file in your custom theme/ custom module.
or
and write your code.
This file only rendered in your specific condition of products.
now in this file you can add your special requirements.
Hope this will help you !..