Create dynamically link in customer account navigation in Magento 2
We can create custom customer account link with reference block customer_account_navigation with a custom block class 1) Add block class in customer_account.xml File: app/code/Vendor/Module/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="{vendor}\{Module}\Block\Customer\Link" name="customer-account-navigation-new-product-link" after="-"> <arguments> <argument name="label" xsi:type="string">Some link</argument> <argument name="path" xsi:type="string">customer/somelink/index</argument> </arguments> </block> </referenceBlock> </body> </page> 2) Now create Link.php namespace Vendor\Module\Block\Customer;…