skip to Main Content

I’m Using Magento EE 2.2.2. I am trying to change the head title of wishlist “My Wish List” to “My Favourites”. I am trying in XML wishlist_index_index.xml and added the below lines.

<?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">
        <head>
            <title>My Favourites</title>
        </head>
 </page> 

But it is not working.

2

Answers


  1. Two way to change Wish-list head title:

    1. Override “MagentoWishlistBlockCustomerWishlist” and set title in “_prepareLayout” function.

    2. Use csv or inline translation.

    Login or Signup to reply.
  2. It’s work for me.

    Create di.xml file in your module app/code/[Vendor]/[Module]/etc/frontend/di.xml

    <?xml version="1.0"?>
    <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
        <preference for="MagentoWishlistBlockCustomerWishlist" type="[Vendor][Module]BlockCustomerWishlist" />
    </config>
    
    

    Create Wishlist.php file app/code/[Vendor]/[Module]/Block/Customer/Wishlist.php

    <?php
    namespace [Vendor][Moudle]BlockCustomer;
    
    class Wishlist extends MagentoWishlistBlockCustomerWishlist
    {
        
        /**
         * Preparing global layout
         *
         * @return $this
         */
        protected function _prepareLayout()
        {
            parent::_prepareLayout();
            $this->pageConfig->getTitle()->set(__('Wish List'));
            
            return $this;
        }
    
    }
    
    

    After that run setup:di:compile command and cache flush command.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search