I had referred this link How to auto fill the shipping address field but this is throw an error This is required Field.
I have to Auto fill Address in Magento 2 Checkout. I have to fill the State and Zip code.
Can anyone have idea to fill it?
di.xml file in `app/code/Vendor/Module/etc/frontend`
<type name="Magento\Checkout\Block\Checkout\LayoutProcessor">
<plugin name="vendor_assign_default_value" type="Vendor\Module\Plugin\Checkout\Model\Checkout\LayoutProcessor" sortOrder="100"/>
</type>
LayoutProcessor file in Vendor\Module\Plugin\Checkout\Model\Checkout
<?php
namespace Vendor\Module\Plugin\Checkout\Model\Checkout;
use Magento\Checkout\Block\Checkout\LayoutProcessor as MageLayoutProcessor;
class LayoutProcessor
{
public function afterProcess(MageLayoutProcessor $subject, $jsLayout)
{
$jsLayout['components']['
checkout']['children']['steps']['children']['shipping-step']['children']
['shippingAddress']['children']['shipping-address-fieldset']['children']['postcode']['value'] = '10012';
return $jsLayout;
}
}