I don't want to remove the whole link from frontend theme I just want to remove a part of the link. I don't know where the file that I should edit it any help?
1 Answer
The PHTML file for header compare product is MAGENTO-ROOT/vendor/magento/module-catalog/view/frontend/templates/product/compare/link.phtml
you can copy the PHTML file to your them and comment out the line as below
Original code:
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
// @codingStandardsIgnoreFile
?>
<li class="item link compare" data-bind="scope: 'compareProducts'" data-role="compare-products-link">
<a class="action compare no-display" title="<?= /* @escapeNotVerified */ __('Compare Products') ?>"
data-bind="attr: {'href': compareProducts().listUrl}, css: {'no-display': !compareProducts().count}"
>
<?= /* @escapeNotVerified */ __('Compare Products') ?>
<span class="counter qty" data-bind="text: compareProducts().countCaption"></span>
</a>
</li>
<script type="text/x-magento-init">
{"[data-role=compare-products-link]": {"Magento_Ui/js/core/app": <?= /* @escapeNotVerified */ $block->getJsLayout() ?>}}
</script>
Change the phtml code it to
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
// @codingStandardsIgnoreFile
?>
<li class="item link compare" data-bind="scope: 'compareProducts'" data-role="compare-products-link">
<a class="action compare no-display" title="<?= /* @escapeNotVerified */ __('Compare Products') ?>"
data-bind="attr: {'href': compareProducts().listUrl}, css: {'no-display': !compareProducts().count}"
>
<?= /* @escapeNotVerified */ __('Compare Products') ?>
<!--<span class="counter qty" data-bind="text: compareProducts().countCaption"></span>-->
</a>
</li>
<script type="text/x-magento-init">
{"[data-role=compare-products-link]": {"Magento_Ui/js/core/app": <?= /* @escapeNotVerified */ $block->getJsLayout() ?>}}
</script>