Jadi katakanlah Anda ingin menghapus blok judul dari halaman sukses. Pertama, Anda perlu menemukan xml yang bertanggung jawab untuk halaman tertentu dalam kasus kamivendor/magento/module-checkout/view/frontend/layout/checkout_onepage_success.xml
Dan dalam file ini Anda akan memiliki konten berikut:
<?xml version="1.0"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<head>
<title>Success Page</title>
</head>
<body>
<referenceBlock name="page.main.title">
<block class="Magento\Checkout\Block\Onepage\Success" name="checkout.success.print.button" template="Magento_Checkout::button.phtml"/>
<action method="setPageTitle">
<argument translate="true" name="title" xsi:type="string">Thank you for your purchase!</argument>
</action>
</referenceBlock>
<referenceContainer name="content">
<block class="Magento\Checkout\Block\Onepage\Success" name="checkout.success" template="Magento_Checkout::success.phtml" cacheable="false">
<container name="order.success.additional.info" label="Order Success Additional Info"/>
</block>
<block class="Magento\Checkout\Block\Registration" name="checkout.registration" template="Magento_Checkout::registration.phtml" cacheable="false"/>
</referenceContainer>
</body>
</page>
Anda sekarang perlu memperpanjang xml ini di tema Anda app/design/frontend/.../.../Magento_Checkout/layout/checkout_onepage_success.xml
Dan di dalamnya referensi blok yang perlu Anda hapus page.main.title
dan tambahkan remove="true"
seperti:
<?xml version="1.0"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<head>
</head>
<body>
<referenceBlock name="page.main.title" remove="true" />
</body>
</page>
Jika Anda ingin menghapus blok tertentu dari semua halaman cms Anda dapat mencapainya dengan memperluas xml default vendor/magento/module-theme/view/frontend/layout/default.xml
di folder tema Anda app/design/frontend/.../.../Magento_Theme/layout/default.xml
seperti:
<?xml version="1.0"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceBlock name="page.main.title" remove="true" />
</body>
</page>
<remove />
-tag. Kesalahan dalam dokumentasi?