6

How to hide this in the "My Account" Admin menu?

enter image description here

Thankyou!

5
  • Do you wish to disable stored payment methods or just remove the menu item?
    – jamil
    Commented Jun 15, 2017 at 17:34
  • Remove the menu item :-)
    – Kara
    Commented Jun 15, 2017 at 18:12
  • What version m2 and are you using someone elses theme?
    – jamil
    Commented Jun 15, 2017 at 20:32
  • @jamil Magento ver. 2.1.7
    – Kara
    Commented Jun 16, 2017 at 15:17
  • and yes im using a custom theme
    – Kara
    Commented Jun 16, 2017 at 15:18

2 Answers 2

8

The menu item comes from Magento_Vault.

The Magento_Vault module implements the integration with the Vault payment gateway and makes the latter available as a payment method in Magento.

If you aren't using it then you can disable it in Config > Advanced > Advanced or you can disable it from the command line.

OR you can disable it using a layout change. The defining layout is here. Magento/Vault/view/frontend/layout/customer_account.xml

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceBlock name="customer_account_navigation">
            <block class="Magento\Framework\View\Element\Html\Link\Current" name="customer-account-navigation-my-credit-cards-link">
                <arguments>
                    <argument name="path" xsi:type="string">vault/cards/listaction</argument>
                    <argument name="label" xsi:type="string" translate="true">Stored Payment Methods</argument>
                </arguments>
            </block>
        </referenceBlock>
    </body>
</page>
2

I don't see "Stored Payment Method" anywhere in vanilla Magento but there is a "My Credit Cards" link on the menu by default. You either have a 3rd party theme or module adding the link, so its difficult to provide an exact answer.

First, I would search your themes' and modules' xml files for the text in the link to see if its originating from there. The file is probably customer_account.xml so you can try just searching for that file.

As an example, to remove "My Credit Cards" you would create or edit the following file:

app/code/{namespace}/{themename}/Magento_Theme/layout/customer_account.xml

Then you create a referenceBlock node with the name attribute matching the block name and a remove attribute with the value true. The referenced block customer_account_navigation exists because the menu item is nested within it:

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceBlock name="customer_account_navigation">
            <referenceBlock name="customer-account-navigation-my-credit-cards-link" remove="true"/>
        </referenceBlock>
    </body>
</page>

The process should be the same for you, however the block name will be different and you may already see it referenced in a file.

This answer also has some steps you can take to find out what the block name is, if my method doesn't work. The key is either adding the aforementioned file or removing the code from an existing file.

This process is generally the same for removing any block in Magento 2's frontend.

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.