0

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 1

0

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>
1
  • thanks that helped :) Apr 14, 2019 at 9:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.