hello, every one
I could manage to disable the country field through the checkout_index_index.xml however there is also an extra client side validation which should be also disabled and I don't know how to
Please share your idea on how to do it on the checkout page
thx
Solved! Go to Solution.
I investigated this issue alot and found out that for the client side validation which is handled by shipping.js it should be override a shipping.js override by mixins that worked perfectly
Hello @Woshka
Follow below shared solution link to remove country validation. you have to override core file of magento Model\Customer\Address\Validator\General\
Customer\Model\Address\CompositeValidator in module-customer/etc/di.xml
https://magento.stackexchange.com/questions/202866/overriding-model-in-magento2
Hello,
there is a client side validation in addition to the serverside
I have implemented bellow code according to the MAgento2 devdoc but it is not working
I have attached the client side error on the Browser console too
let me know which I have an error in it
I have tried many types of country which none was working
disabled the country_id in the .xml file that has removed it
<item name="country_id" xsi:type="array"> <item name="visible" xsi:type="boolean">false</item> <item name="validation" xsi:type="array"> <item name="required-entry" xsi:type="boolean">false</item> </item> <item name="config" xsi:type="array"> <item name="componentDisabled" xsi:type="boolean">true</item> </item> </item>
namespace MaroonHost\CheckoutPageModification\Plugin\Frontend\Magento\Checkout\Block\Checkout; class LayoutProcessor { public function aroundProcess( \Magento\Checkout\Block\Checkout\LayoutProcessor $subject, \Closure $proceed, $jsLayout ) { $result = $proceed($jsLayout); //$ret = $proceed($jsLayout); unset($result['components']['checkout']['children']['steps']['children']['shipping-step'] ['children']['shippingAddress']['children']['shipping-address-fieldset']['children']['company']); unset($result['components']['checkout']['children']['steps']['children']['shipping-step'] ['children']['shippingAddress']['children']['shipping-address-fieldset']['children']['country_id']); unset($result['components']['checkout']['children']['steps']['children']['shipping-step'] ['children']['shippingAddress']['children']['shipping-address-fieldset']['children']['countryid']); unset($result['components']['checkout']['children']['steps']['children']['shipping-step'] ['children']['shippingAddress']['children']['shipping-address-fieldset']['children']['countryId']); unset($result['components']['checkout']['children']['steps']['children']['shipping-step'] ['children']['shippingAddress']['children']['shipping-address-fieldset']['children']['countryiD']); unset($result['components']['checkout']['children']['steps']['children']['shipping-step'] ['children']['shippingAddress']['children']['shipping-address-fieldset']['children']['country_Id']); unset($result['components']['checkout']['children']['steps']['children']['shipping-step'] ['children']['shippingAddress']['children']['shipping-address-fieldset']['children']['country']); // return $ret; // //Your plugin code return $result; } }