Magento – Magento 2 : State dropdown showing regionID is required field

magento2

I am using magento 2.1. On Admin side on order creation page, some specific countries have states in dropdown. I need to show state dropdown for India country. For this purpose I have fired following 2 queries.

INSERT INTO `directory_country_region` VALUES
(548 , 'IN', '35','Andaman Nicobar'),
(549 , 'IN', '28','Andhra Pradesh'),
(550 , 'IN', '12','Arunachal Pradesh'),
(551 , 'IN', '18','Assam'),
(552 , 'IN', '10','Bihar'),
(553 , 'IN', '04','Chandigarh'),
(554 , 'IN', '22','Chhattisgarh'),
(555 , 'IN', '26','Dadra Nagar Haveli'),
(556 , 'IN', '25','Daman Diu'),
(557 , 'IN', '07','Delhi'),
(558 , 'IN', '30','Goa'),
(559 , 'IN', '24','Gujarat'),
(560 , 'IN', '06','Haryana'),
(561 , 'IN', '02','Himachal Pradesh'),
(562 , 'IN', '01','Jammu Kashmir'),
(563 , 'IN', '20','Jharkhand'),
(564 , 'IN', '29','Karnataka'),
(565 , 'IN', '32','Kerala'),
(566 , 'IN', '31','Lakshadweep'),
(567 , 'IN', '23','Madhya Pradesh'),
(568 , 'IN', '27','Maharashtra'),
(569 , 'IN', '14','Manipur'),
(570 , 'IN', '17','Meghalaya'),
(571 , 'IN', '15','Mizoram'),
(572 , 'IN', '13','Nagaland'),
(573 , 'IN', '21','Odisha'),
(574 , 'IN', '34','Pondicherry'),
(575 , 'IN', '03','Punjab'),
(576 , 'IN', '08','Rajasthan'),
(577 , 'IN', '11','Sikkim'),
(578 , 'IN', '33','Tamil Nadu'),
(579 , 'IN', '36','Telangana'),
(580 , 'IN', '16','Tripura'),
(581 , 'IN', '09','Uttar Pradesh'),
(582 , 'IN', '05','Uttaranchal'),
(583 , 'IN', '19','West Bengal');

Second Query :

INSERT INTO `directory_country_region_name` (`locale`, `region_id`, `name`) VALUES
('en_US',548,'Andaman Nicobar'),
('en_US',549,'Andra Pradesh'),
('en_US',550,'Arunachal Pradesh'),
('en_US',551,'Assam'),
('en_US',552,'Bihar'),
('en_US',553,'Chandigarh'),
('en_US',554,'Chhattisgarh'),
('en_US',555,'Dadar and Nagar Haveli'),
('en_US',556,'Daman Diu'),
('en_US',557,'Delhi'),
('en_US',558,'Goa'),
('en_US',559,'Gujarat'),
('en_US',560,'Haryana'),
('en_US',561,'Himachal Pradesh'),
('en_US',562,'Jammu and Kashmir'),
('en_US',563,'Jharkhand'),
('en_US',564,'Karnataka'),
('en_US',565,'Kerala'),
('en_US',566,'Lakshadweep'),
('en_US',567,'Madhya Pradesh'),
('en_US',568,'Maharashtra'),
('en_US',569,'Manipur'),
('en_US',570,'Meghalaya'),
('en_US',571,'Mizoram'),
('en_US',572,'Nagaland'),
('en_US',573,'Odisha'),
('en_US',574,'Pondicherry'),
('en_US',575,'Punjab'),
('en_US',576,'Rajasthan'),
('en_US',577,'Sikkim'),
('en_US',578,'Tamil Nadu'),
('en_US',579,'Telangana'),
('en_US',580,'Tripura'),
('en_US',581,'Uttar Pradesh'),
('en_US',582,'Uttaranchal'),
('en_US',583,'West Bengal');

After firing above queries, on order page, in country dropdown when I select India, state dropdown is getting populated. But when I select state and fills other required info and submits page, it is showing me following error.

"regionId is a required field."

Not able to fix this issue. Kindly help if anyone knows.

Best Answer

Have you updated general/region/state_required config value in core_config_data list with AT,BR,CA,CH,EE,ES,FI,HR,IN,LT,LV,RO,US Updating this should work for you else you can simply rollback your query and install this module to solve your problem.

This module updates all required database entries and show drop-down for states in frontend.

https://packagist.org/packages/credevlabz/magento2-directory-indian-states

Related Topic