Skip to main content
deleted 2 characters in body
Source Link
Charmi Patel
  • 1.2k
  • 2
  • 16

For Remove "items" text in wishlist header icon count follow below steps:

1.Create a di.xml file in the Vendor/Module/etc directory and add below code:

<?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="Magento\Wishlist\CustomerData\Wishlist" type="Vendor\Module\CustomerData\Wishlist" />
</config>

2.Create a Wishlist.php file at Vendor/Module/CustomerData directory and add the below code:

<?php
namespace Vendor\Module\CustomerData;

use Magento\Wishlist\CustomerData\Wishlist as CoreWishlist;

class Wishlist extends CoreWishlist
{
    public function __construct(\Magento\Wishlist\Helper\Data $wishlistHelper, \Magento\Wishlist\Block\Customer\Sidebar $block, \Magento\Catalog\Helper\ImageFactory $imageHelperFactory, \Magento\Framework\App\ViewInterface $view, \Magento\Catalog\Model\Product\Configuration\Item\ItemResolverInterface $itemResolver = null)
    {
        parent::__construct($wishlistHelper, $block, $imageHelperFactory, $view, $itemResolver);
    }

    /**
     * @param $count
     * @return \Magento\Framework\Phrase|null
     */
    protected function createCounter($count)
    {
        if ($count > 1) {
            //you can also add your custom text
            return __('%1', $count);
        } elseif ($count == 1) {
            return __('1');
        }
        return null;
    }
}

3.then run the below commands and update wishlist,

php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento cache:flush

please check the result,

Let me know if you have any queriesquery.

For Remove "items" text in wishlist header icon count follow below steps:

1.Create a di.xml file in the Vendor/Module/etc directory and add below code:

<?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="Magento\Wishlist\CustomerData\Wishlist" type="Vendor\Module\CustomerData\Wishlist" />
</config>

2.Create a Wishlist.php file at Vendor/Module/CustomerData directory and add the below code:

<?php
namespace Vendor\Module\CustomerData;

use Magento\Wishlist\CustomerData\Wishlist as CoreWishlist;

class Wishlist extends CoreWishlist
{
    public function __construct(\Magento\Wishlist\Helper\Data $wishlistHelper, \Magento\Wishlist\Block\Customer\Sidebar $block, \Magento\Catalog\Helper\ImageFactory $imageHelperFactory, \Magento\Framework\App\ViewInterface $view, \Magento\Catalog\Model\Product\Configuration\Item\ItemResolverInterface $itemResolver = null)
    {
        parent::__construct($wishlistHelper, $block, $imageHelperFactory, $view, $itemResolver);
    }

    /**
     * @param $count
     * @return \Magento\Framework\Phrase|null
     */
    protected function createCounter($count)
    {
        if ($count > 1) {
            //you can also add your custom text
            return __('%1', $count);
        } elseif ($count == 1) {
            return __('1');
        }
        return null;
    }
}

3.then run the below commands and update wishlist,

php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento cache:flush

please check the result,

Let me know if you have any queries.

For Remove "items" text in wishlist header icon count follow below steps:

1.Create a di.xml file in the Vendor/Module/etc directory and add below code:

<?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="Magento\Wishlist\CustomerData\Wishlist" type="Vendor\Module\CustomerData\Wishlist" />
</config>

2.Create a Wishlist.php file at Vendor/Module/CustomerData directory and add the below code:

<?php
namespace Vendor\Module\CustomerData;

use Magento\Wishlist\CustomerData\Wishlist as CoreWishlist;

class Wishlist extends CoreWishlist
{
    public function __construct(\Magento\Wishlist\Helper\Data $wishlistHelper, \Magento\Wishlist\Block\Customer\Sidebar $block, \Magento\Catalog\Helper\ImageFactory $imageHelperFactory, \Magento\Framework\App\ViewInterface $view, \Magento\Catalog\Model\Product\Configuration\Item\ItemResolverInterface $itemResolver = null)
    {
        parent::__construct($wishlistHelper, $block, $imageHelperFactory, $view, $itemResolver);
    }

    /**
     * @param $count
     * @return \Magento\Framework\Phrase|null
     */
    protected function createCounter($count)
    {
        if ($count > 1) {
            //you can also add your custom text
            return __('%1', $count);
        } elseif ($count == 1) {
            return __('1');
        }
        return null;
    }
}

3.then run the below commands and update wishlist,

php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento cache:flush

please check the result,

Let me know if you have any query.

Source Link
Charmi Patel
  • 1.2k
  • 2
  • 16

For Remove "items" text in wishlist header icon count follow below steps:

1.Create a di.xml file in the Vendor/Module/etc directory and add below code:

<?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="Magento\Wishlist\CustomerData\Wishlist" type="Vendor\Module\CustomerData\Wishlist" />
</config>

2.Create a Wishlist.php file at Vendor/Module/CustomerData directory and add the below code:

<?php
namespace Vendor\Module\CustomerData;

use Magento\Wishlist\CustomerData\Wishlist as CoreWishlist;

class Wishlist extends CoreWishlist
{
    public function __construct(\Magento\Wishlist\Helper\Data $wishlistHelper, \Magento\Wishlist\Block\Customer\Sidebar $block, \Magento\Catalog\Helper\ImageFactory $imageHelperFactory, \Magento\Framework\App\ViewInterface $view, \Magento\Catalog\Model\Product\Configuration\Item\ItemResolverInterface $itemResolver = null)
    {
        parent::__construct($wishlistHelper, $block, $imageHelperFactory, $view, $itemResolver);
    }

    /**
     * @param $count
     * @return \Magento\Framework\Phrase|null
     */
    protected function createCounter($count)
    {
        if ($count > 1) {
            //you can also add your custom text
            return __('%1', $count);
        } elseif ($count == 1) {
            return __('1');
        }
        return null;
    }
}

3.then run the below commands and update wishlist,

php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento cache:flush

please check the result,

Let me know if you have any queries.