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;…

Continue Reading Create dynamically link in customer account navigation in Magento 2

Check Customer is logged in using knockout js Magento 2

We can use Magento_Customer/js/model/customercomponent to check if the customer is logged in or not in knockout js. Check full component here customer.js We can use isLoggedIn() method. It will return true if customer is loggedIn and return false if customer is not loggedIn Check below code snippet of JS: define([ 'uiComponent', 'Magento_Customer/js/model/customer' ], function (Component,…

Continue Reading Check Customer is logged in using knockout js Magento 2