I want to hide shipping method when user is not logged in in checkout page.
After selecting the city shipping methods to be shown in checkout page.
So, Is there any solution for this I have try this code :
if (!customer.isLoggedIn()) {
self.visible(false);
}
But its not working as i want. when I put this code in my shipping.js file near about line no 123-124 inside initialize function it hides whole form includes registration form and shipping method, So I need to hide only the shipping method
Thanks
Best Answer
You can also hide shipping method with shipping.html
Override shipping.html in your module
Now Add
<!-- ko if: (isCustomerLoggedIn) -->
before shipping method<li>
tag and end<!-- /ko -->
after</li>
to check customer is loggedIn or not.Sample: