My website is multi-store

Magento after upgrade 2.2.7 to 2.3.4, facing an issue which creates new order as below

countryId is required. Enter and try again.

On debug I came across that issue is in file

[2020-02-14 10:14:59] report.CRITICAL: "countryId" is required. Enter and try again. {"exception":"[object] (Magento\Framework\Exception\InputException(code: 0): \"countryId\" is required. Enter and try again. at vendor/magento/module-customer/Model/ResourceModel/AddressRepository.php:133)"}

I have verified this link https://github.com/magento/magento2/issues/14232 but not working

Following code is causing the issue

/*$countryElement = $this->_form->getElement('country_id');


    if ($countryElement->getValue()) {
        $countryId = $countryElement->getValue();
        foreach ($countryElement->getValues() as $country) {
            if ($country['value'] == $countryId) {
    if ($countryElement->getValue() === null) {

3 Answers 3


Go to Stores -> General -> State Option and then unselect all country and clear cache and try again

  • Not working. We have already this solution
    – Arjun
    Commented Feb 26, 2020 at 8:53

Based on your code it looks like this when you are creating an order in the admin area?

It's hard to give a detailed answer without seeing your code base but these questions might help:

  1. Are there any custom changes to the address form that might mean the country id is removed or missing? (This might have been "ok" to do in 2.2 but not 2.3)

  2. Have you tried logging/dumping the value of $this->_form->getElement('country_id'); at that point?

  3. Does this happen when you create an order through the front end as well?

  • 1. We have not made any changes, 2. It is returning 'Null', 3. In frontend it is working fine
    – Arjun
    Commented Mar 5, 2020 at 8:58

You need to run this command:

update eav_attribute set is_required = 0 where attribute_code = 'country_id'
  • We tried this but not working
    – Arjun
    Commented Mar 12, 2020 at 8:55
  • please clear cache and try to run the command again. Commented Mar 13, 2020 at 1:28
  • After making changes I have ran all magento commands
    – Arjun
    Commented Mar 13, 2020 at 7:18
  • No it is not working
    – Arjun
    Commented Mar 17, 2020 at 5:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.