magento2: "Customer > Address > State/Province" in admin backend does not honour the "State is Required for" setting, is always required

the “State/Province” (attribute region_id) selectbox in “Customers > Customer > {edit} > Addresses” is always marked as “required” when the selected country has states - even when the option “State is Required for” in “Stores > Configuration > General > State Options” is not enabled for this country.

this prevents saving the customer.

Preconditions

  1. CE 2.1.0

Steps to reproduce

  1. in “Stores > Configuration > General > Country Options” enable a country that has regions/states, we’ll use “Switzerland” for the rest of the steps.
  2. in “Stores > Configuration > General > State Options” ensure option “State is Required for” is not enabled for “Switzerland”
  3. save, clear config cache
  4. create or edit a customer, add or edit this customers address
  5. select “Country: Switzerland”

Expected result

  1. The “State/Province” selectbox is popuplated and not mandatory

Actual result

  1. The “State/Province” selectbox is popuplated and marked as required

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 17 (9 by maintainers)

Most upvoted comments

I think the test case was not properly followed as it is reproducible in a 2.1.5 installation.

heck, even the latest development code has still the bogus <item name="required-entry" xsi:type="boolean">true</item> validation on the region_id field.

@sma09sjb, @EliasKotlyar just validated on fresh installation for 2.1.5 and 2.2-develop, and it test case is not reproducible.