0

I am new to Magento, and am modifying Magento 2.2. There is a element at the top of the page which I cannot get it removed. This is what I have already done:

  1. I have tried to remove the content within the CustomTheme > Magento_Theme > template > html > header.phtml , but even removing the entire content in this file will not remove the element.

  2. I tried to remove the element through the default.xml in my custom template, using the following code:

    <referenceBlock name="authorization-link" remove="true" />
    

But I am guessing I am using the wrong reference block name since the code did not remove it.

Any help would be greatly appreciated, also note that this is appearing after the customer is logged in. I have attached a screenshot showing what element I want to remove, thank you.

Showing the ul element to be removed

  • have you tried clearing cache and redeploying static content after above code? – MTM Feb 23 '18 at 7:30
  • Yes, I have flushed out the cache through both Magento admin itself and through SSH, I also removed the Static folder completely along with other cache folders in the (MainMagentoFolder > Var), and deployed again, but it did not help. – Ogdila Feb 23 '18 at 15:01
0

if you can't find a way to remove it from xml file, you can try to add custom css file and javascript file to default.xml, the css will hide the <ul> element first then remove the <ul> element using javascript function.

default.xml

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <head> 
        <css src="css/custom.css"/>
        <link src="js/custom.js"/>
    </head>
</page>

custom.css

ul.header.links{
  display: none;
}

custom.js

define([
  'jquery',
  'jquery/ui'
], function($){
  $( document ).ready(function() {
    $('ul.header.links').remove();
  });
})
  • Thank you for the comment, I have already created some custom CSS on multiple pages, but I am trying to avoid removing elements through CSS if they are never to be used. – Ogdila Feb 23 '18 at 2:48
0

I have found the answer my own question:

I could remove the element by overriding the customer.phtml within the CustomTheme/Magento_customer/templates/account/customer.phtml

Note that it did not remove the <ul> element, but I could get to remove the content within the <ul> so it does not load anymore.

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.