I wanna make City optinal. I was made in JS a Dropdown so i can select the city. I put "city" textbox in display:none in CSS and next, copy onchange the dropbox text into this city textbox so the process don't broken.

But i see if i copy the text, the Magento mark me as "required" fiel.

The process is:

User select "Bogotá" Script copy "Bogota" from de dropbox to the "City" textbox User click "place order" Magento 2 warning Textbox are empty (wen no, i check it)

If i remove a letter from the textbox (Bogotá to Bogot) and next put it again, the process continue without problem.

For this, i wanna make City optional cause i validate the textbox aren't empty.


Magento 2.3.0


I was found the solution myself.

Run this on your database:

UPDATE `eav_attribute` SET `is_required` = 0 WHERE `attribute_code` = 'city';

And it will be done!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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