GetResponse / magento

8 stars 9 forks source link

Do not use cache="false" in any block in layout default.xml #64

Open cieslix opened 2 months ago

cieslix commented 2 months ago

https://github.com/GetResponse/magento/blob/master/view/frontend/layout/default.xml#L28

<block name="getresponse.order.placed" class="GetResponse\GetResponseIntegration\Block\Checkout\OrderPlaced" 
template="GetResponse_GetResponseIntegration::checkout/order_placed.phtml" cacheable="false" />

Do not use such configuration in layout/default.xml this is killing Magento2 performance - all pages are not cacheable in full page cache because this one small block. Move it to specific layout xml like layout/checkout_onepage_success.xml.

pczerkas commented 2 months ago

@cieslix Maybe this holds for some old versions of Magento, but this is not true for example for 2.4.6-x

Set a break here and see yourself: image

They are referencing a container, which exists only during checkout:

<referenceContainer name="order.success.additional.info">
    <block name="getresponse.order.placed" class="GetResponse\GetResponseIntegration\Block\Checkout\OrderPlaced" template="GetResponse_GetResponseIntegration::checkout/order_placed.phtml" cacheable="false" />
</referenceContainer>