![]() Now run the below command and check on any product view page. Specify actions that trigger cache invalidation for private content blocks in a sections.xml configuration file in the Vendor/ModuleName/etc/frontend directory. This.customsection = customerData.get('custom_section') Next, We will create section.js in app/code/Vendor/Module/view/frontend/web/js directory. In Magento 2 Admin, Go to Stores > Configuration > Advanced > System > Full Page Cache. "component": " Vendor_ Module/js/section" Hi, Im hope someone will find this post useful. Next, we will create a custom_section.phtml in app/code/ Vendor/ Module/view/frontend/templates directory. Next, we will create catalog_product_view.xml in app/code/Vendor/Module/view/frontend/layout directory. You can get section data in any Magento pages. ![]() We will display our custom section data in the product view page. Step 2: Display custom section data in frontend In getSectionData() method we will define our data that we want to store in section. ![]() Next, create CustomSection.php file in app/code/Vendor/Module/CustomerData directory. Vendor\ Module\CustomerData\CustomSection We will define a custom section in the di.xml file by adding a new section into sections pool.Ĭreate di.xml file in app/code/Vendor/Module/etc/frontend directory. Magento tracks when some section is changed and load updated section automatically. Magento loads sections by AJAX request to /customer/section/load/ and caches loaded data in the browser local storage under the key mage-cache-storage. We will show here how we can display a private content in a full cached page, it is very useful if you want to display information per customer
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |