Today we are going to talk about how to remove the postcode field in checkout in Magento 2?
The field is dynamically created from EAV attributes on the LayoutProcessor class.
All we need to do is to set is_user_defined to 1 for the postcode eav_attribute. I recommend doing this via a setup resource, like this:
1 2 3 4 5 6 7 8 9 10 11 12 |
public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context) { /** @var \Magento\Customer\Setup\CustomerSetupFactory $customerSetup */ $customerSetup = $this->customerSetupFactory->create(['setup' => $setup]); $setup->startSetup(); $attribute = $customerSetup->getEavConfig()->getAttribute('customer_address', 'postcode'); $attribute->setIsUserDefined(1)->save(); $attribute->save(); } |
also, we need to remove validation for that, so we can direct set 0 to DB in eav_attribute table
that’s it.
[crayon-63e096192cea5692987243/] Using above fucntion Images can be imported directly from...
Override view block using di.xml and add the below code...
You can check a list of called layout XML for...
Follow the below steps to install and set up PWA...
If you want to remove all leading zero's from order,...
Let our Magento expert connect to discuss your requirement.
We offer Magento
certified developers.
Our Magento clientele
is 500+.
We sign NDA for the
security of your projects.
We’ve performed 100+
Magento migration projects.
Free quotation
on your project.
Three months warranty on
code developed by us.