cancel
Showing results for 
Search instead for 
Did you mean: 

How To Remove a CSS Class Added Via Layout XML

SOLVED
Highlighted

How To Remove a CSS Class Added Via Layout XML

Hi there,

 

  I am trying to remove a class that is added in a layout xml file. it is added in the wishlist_index_index.xml via:

 

 
<block class="Magento\Wishlist\Block\Customer\Wishlist\Item\Column\Actions" name="customer.wishlist.item.inner" template="Magento_Wishlist::item/column/actions.phtml" cacheable="false">
    <arguments>
        <argument name="css_class" xsi:type="string">product-item-inner</argument>
    </arguments>
</block>
I understand I need to overwrite the file in my site directory but have no idea how to reference this and remove it.
 
Help appreciated! Thanks
 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions

Re: How To Remove a CSS Class Added Via Layout XML

Ok it appears you can just re-add the argument in overwritten xml file and just leave it blank, which achieves what it needs to...

 

<referenceBlock name="block.name">
                <arguments>
                    <argument name="css_class" xsi:type="string"></argument>
                </arguments>
            </referenceBlock>

View solution in original post

3 REPLIES 3
Highlighted

Re: How To Remove a CSS Class Added Via Layout XML

Hi @bwainfindeaafb 

Yes, you need to override the xml file in your custom theme.

You can use the following magento document for override the xml file.

https://devdocs.magento.com/guides/v2.3/frontend-dev-guide/layouts/layout-override.html

I hope it will help you!

----
Problem solved? Click Accept as Solution!
Highlighted

Re: How To Remove a CSS Class Added Via Layout XML

Thanks, this is helpful, but trying to work out how to stop displaying this css class?

I understand that in the overwriting xml file I can use

 

<referenceBlock name="block.name" remove="true"/>

to remove a block, but how to I remove the class? Is it <referenceArgument> or how is it achieved?

 

Thanks

Re: How To Remove a CSS Class Added Via Layout XML

Ok it appears you can just re-add the argument in overwritten xml file and just leave it blank, which achieves what it needs to...

 

<referenceBlock name="block.name">
                <arguments>
                    <argument name="css_class" xsi:type="string"></argument>
                </arguments>
            </referenceBlock>

View solution in original post