1

After i upgrade from Magento 2.3.4 to Magento 2.4.1 after choosing the shipping address in the checkout page, i got this error:

Please specify regionId in shipping address

then i see the region is missing from the address in checkout page:

enter image description here

after i add new address, the region was not there either enter image description here

before in Magento 2.3.4 it's showing fine like this:

enter image description here

Tiny Dancer
  • 620
  • 1
  • 16
  • 30
  • It might help you https://magento.stackexchange.com/a/241913/21339 – Arunendra Oct 28 '20 at 03:50
  • @Arunendra the answer is for magento 2.2 , it has different file content with magento 2.4.1 – Tiny Dancer Oct 28 '20 at 06:01
  • I recommend you to create an issue on github https://github.com/magento/magento2/issues/new?template=bug_report.md – Black Nov 10 '20 at 13:30
  • You might want to add more information about the issue. Can you check what kind of js error you see on the browser console ? Also did you check if there were any theme override in 2.3.5 which might need to updated with 2.4 version of theme files ? – rex Nov 10 '20 at 18:47
  • @TinyDancer Me too facing this same issue in my Live site, Could you please let me know the solution which you used to fix this issue. – Sathya Jun 30 '22 at 11:02

1 Answers1

0

Used the JS debugger to figure the error was coming from here: https://github.com/magento/magento2/blob/2.3.5-p2/app/code/Magento/Checkout/view/frontend/web/js/view/shipping.js#L340

On that line, the code looks for region in the shippingAddress observable but when saving a new address for a not logged in user, in this case Magento is not setting the "region" property on the shippingAddress object, instead only regionId is set since the name of the region dropdown field for US is regionId.

As a workaround on line 212 of shipping.js I would add:

var regionSelector = '#co-shipping-form select[name=region_id] option:selected';
if (addressData['region_id'] == $(regionSelector).val()) {
addressData['region'] = $(regionSelector).text();
}

This is not the perfect framework fix, but should be safe enough for anyone looking to resolve this important checkout issue.

Rakesh Donga
  • 5,344
  • 2
  • 24
  • 57