There might be a requirement in store that never intends to offer gift cards. Today we gonna learn how to remove component/block from storefront.
Remove component from Checkout Page
<VendorName>/<ModuleName>/view/frontend/layout/checkout_index_index.xml
<?xml version="1.0"?>
<page layout="1column" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceBlock name="checkout.root">
<arguments>
<argument name="jsLayout" xsi:type="array">
<item name="components" xsi:type="array">
<item name="checkout" xsi:type="array">
<item name="children" xsi:type="array">
<item name="steps" xsi:type="array">
<item name="children" xsi:type="array">
<item name="billing-step" xsi:type="array">
<item name="children" xsi:type="array">
<item name="payment" xsi:type="array">
<item name="children" xsi:type="array">
<item name="afterMethods" xsi:type="array">
<item name="children" xsi:type="array">
<item name="giftCardAccount" xsi:type="array">
<item name="config" xsi:type="array">
<item name="componentDisabled"
xsi:type="boolean">true
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</argument>
</arguments>
</referenceBlock>
</body>
</page>
Remove block from Cart Page
<VendorName>/<ModuleName>/view/frontend/layout/checkout_cart_index.xml
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceContainer name="cart.summary">
<referenceBlock name="checkout.cart.giftcardaccount" remove="true"/>
</referenceContainer>
</body>
</page>
Remove Gift Card link from My Account sidebar
<VendorName>/<ModuleName>/view/frontend/layout/customer_account.xml
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<!-- Gift Card link -->
<referenceBlock name="customer-account-navigation-gift-card-link" remove="true"/>
</body>
</page>
Cheers! Happy Coding.