How to use if else conditions in Knockout JS Magento 2?

You can use knockout if-else conditions in Magento 2 with knockout way or Magento 2 approaches.

You have to use ifnot for the else conditions. else is not supported in knockout.

Knockout if and ifnot conditions same as if and else conditions in javascript.

Using Default Knockout JS
1. First Way Continue reading “How to use if else conditions in Knockout JS Magento 2?”

How to set default shipping address of the customer Magento 2?

Set Default shipping address id of the customer in Magento 2 using Address Repository Interface.

You required Customer Id to set shipping address and address id you want to assign it.

First, load the existing address by the getById method of the address repository interface with the set customer. Continue reading “How to set default shipping address of the customer Magento 2?”

How to remove input field from ui component form Magento 2?

You can remove any input field or components using <visible>false</visible> in the <settings> node of the fieldset in ui component form.

Let’s assume you have created a custom form component in the admin panel UI or want to remove an existing field from the UI component, create a form XML file with the given code snippet. Continue reading “How to remove input field from ui component form Magento 2?”