How to add the Custom Layout Update on Magento 2.3.4?
In Magento 2.3.4, there is no more the Layout Update XML field in the admin panel. Instead of it, you will find the Custom Layout Update dropdown on the CMS Page Edit, Category Edit, and Product Edit pages. It was done to increase the security level of the system.
→ Looking for a unique solution? Our team is ready to help with the custom development
Now, to make a custom Magento layout update, you need to create a file and place it on the server in the module or theme folder, for example, app/design/frontend/THEME/LOCALE/layout. Then you will be able to choose its name from the list in the admin panel. Magento loads all layouts and looks for those among them that meet the following conditions:
1) For product pages: catalog_product_view_selectable_PRODUCT_SKU_ANYNAME.xml
For example catalog_product_view_selectable_24-MB01_CUSTOM.xml
Check vendor/magento/module-catalog/Model/Product/Attribute/LayoutUpdateManager.php to get additional data.
2) For category pages: catalog_category_view_selectable_CATEGORYID_ANYNAME.xml
For example catalog_category_view_selectable_5_CUSTOM.xml
Go to vendor/magento/module-catalog/Model/Category/Attribute/LayoutUpdateManager.php for more details.
If you already had some Layout Update on the previous Magento version, you will see the Use existing option. It means your previous Magento layout was saved, and you can use it on the frontend. If you try to add or change this Layout Update, you will get the following error:
“Custom layout update text cannot be changed, only removed”
Check the official documentation to learn more about changes in creating a custom layout in Magento 2 and about other Magento 2.3.4 changes.
→ Improve your storefront with responsive and customizable Jet Theme