I'm working in Magento 2 industry as a developer. I'm in a situation that i need to make a hole punching for a specific block.
The block contains the reviews got from Trustpilot. I use curl to call Trustpilot API. The thing is my review list on product page and the star for each product on category page are cached by full page cache. How can I make it isn't cached?
I read this article about creating a hole punching by using identities https://trellis.co/blog/magento2-fpc-hole-punching/. But my Trustpilot extension didn't use model to store the reviews (Every time I called API directly to fetch new review)
Does anyone have any advice for my situation? Should I keep fetching the reviews directly by using Trustpilot API? Or I should I do it another way? Thanks


The easiest way, in this case, is to use Ajax. I'm pretty sure this way will work as your expectation.

One more thing, please avoiding use XML: cacheable=”false”.

  • 1
    Using cacheable=”false” affect entire page to cacheable false and its create issue for page performance. – Rakesh Jesadiya Feb 9 '18 at 8:33
  • @RakeshJesadiya as I said above please avoiding use XML: cacheable=”false”. – Khoa TruongDinh Feb 9 '18 at 9:15
  • Yes, I appreciate your quote, I just comment on why we don't need to use. I am not showing off your error. – Rakesh Jesadiya Feb 9 '18 at 9:23
  • 1
    Thank for your advice. But I still want to know how to create a hole punching full page cache for a block or a section on the page. – thanhdv2811 Mar 1 '18 at 1:53
  • @thanhdv2811 I need time to investigate more about full page cache. I will be back and answer your question. – Khoa TruongDinh Mar 1 '18 at 2:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.