Skip to content

How to move Stored Payment Methods Component to Account Information Page

I tried moving the Stored Payment Methods Block of the module vault (Original at) (vendor/magento/module-vault/view/frontend/templates/cards_list.phtml) to the Account Information Block of the module customer. (Original at) (vendor/magento/module-customer/view/frontend/templates/account/dashboard/info.phtml)

In customer_account_index.xml I did:

<referenceBlock name="customer_account_dashboard_info">
  <block class="MagentoVaultBlockCustomerCreditCards" name="vault.cards.list" cacheable="false" template="Magento_Vault::cards_list.phtml" />
</referenceBlock>

And then in info.phtml:

 <!-- Stored Payment Method Code -->
 <?php echo $block->getChildHtml('vault.cards.list'); ?>

but by doing this only its header is displayed and the card details aren’t. I’m not sure what is wrong. Below I have attached the Screenshot.

For reference, In cards_list.phtml file the code responsible to render the body of the card details is

<tbody>
   <?php
   foreach ($tokens as $token) {
     echo $block->renderTokenHtml($token);
    }
   ?>
 </tbody>

I’ve tried different methods of moving but still, it isn’t showing up. I’ve also moved other components this way and it has worked for me in the past.

What I would’ve to do for the card details to also show up.

The file responsible to render card details is at vendor/magento/module-vault/view/frontend/templates/customer_account/credit_card.phtml

enter image description here

enter image description here