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?”
Create a customer address attribute programmatically in Magento 2 using the simple module by Best Coding Standard Approach using Setup patch data.
In our demo, I have created a simple text field attribute for a customer address called Nickname.
You can see a customer attribute in backend using Customer -> All Customer -> Click on Edit Customer Link.
Go to Addresses Tab and edit or add new Address. Continue reading “Create customer address attribute Programmatically using Patch data in Magento 2.3”
You can ignore address validation for shipping and billing address when you create address programmatically or sometimes you don’t need to worry about validation for billing or shipping address.
Make sure addresses will be saved without validation errors, You need to use setShouldIgnoreValidation(true) function on quote object. Continue reading “How to ignore address validation error in Magento 2?”