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.

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

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)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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