How to override address/book phtml in Magento 2?

You can override the book.phtml file in Magento 2 using XML.
Book template used to display the address book of the customer with default billing and shipping address at the top of the Address book page.


Book Block class contains the native method for the template.
You can override using theme or module level,

  • 1. Theme Level,
    • app/design/frontend/{Vendor}/{themename}/Magento_Customer/templates/address/book.phtml
  • 2. Module Level,

When you explore the customer_address_index.xml file from the customer module, You can see the address_book block that will be used to display the address book page on the frontend.

In your module create the same XML file, app/code/Jesadiya/Book/view/frontend/layout/customer_address_index.xml,

<?xml version="1.0"?>
<page xmlns:xsi="" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
        <referenceBlock name="address_book">
            <action method="setTemplate">
                <argument name="template" xsi:type="string">Jesadiya_Book::address/book.phtml</argument>

Create Template file to override book.phtml,

In the above module, Jesadiya_Book is the Module name for simplicity.

Keep the required content from the Core template and modify your changes. If you want to change an additional section in a page, Override address/grid.phtml in Magento 2.

Clear Cache to see changes,
php bin/magento cache:flush

This is the simplest way to override the address book content in Magento 2.