2

I am trying to make the topmenu root category not clickable using this method

https://community.magento.com/t5/Magento-2-x-Programming/Remove-links-to-top-categories-in-menu/td-p/77072

but it doesn't seem to work. Anybody as a solution for this I've been looking for the past 5 hours.

2
  • Hello @Gabriel, Did my solution worked for you ? Or you need any help ?
    – Pawan
    Sep 24, 2018 at 3:44
  • Did you get a chance to look at my answer ?
    – Pawan
    Oct 7, 2018 at 6:38

1 Answer 1

1

The reference link you added in question is working fine and disabling click on top level category. However if above solution not worked for you alternatively you can achieve this by using jQuery.

You can use:

require(['jquery', 'jquery/ui'], function($){
  jQuery(document).ready( function() {
    jQuery("a.level-top").prop("href", "javascript:void(0)");
  });
});

Above code will replace all top level href to javascript:void(0)

2
  • It's Working.....!
    – Devidas
    Nov 5, 2019 at 9:59
  • glad to know :)
    – Pawan
    Nov 5, 2019 at 16:14

Your Answer

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

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