3

Just testing my shipping for a logged-in customer on Magento 2.2.5

When I come to the checkout I get the following error.

Please check the shipping address information. Invalid value of "183" provided for the regionId field.

An address that I previously used is going through fine but this seems to happen when I try to enter a new address. A screenshot is provided

enter image description here

Having tested this it seems that this error occurs when the billing and shipping addresses are in a different country.

I realize that it would be a rare occurrence when the payment method is registered to a different country to a billing address but I wondered if there was any way to get around this for instances where the user is in temporary accommodation (working in another country for example) or is ordering for someone else (for example if someone in Northern Ireland is ordering for an address in the Republic of Ireland then they would technically be in a different country).

Teja Bhagavan Kollepara
  • 3,816
  • 5
  • 32
  • 69
CJNotts
  • 402
  • 1
  • 8
  • 41
  • For some reason entering a default billing address seems to have resolved this problem.

    Still unsure how this has occurred but for now seems to be a good workaround

    – CJNotts Sep 12 '18 at 09:21

1 Answers1

6

@CJNotts

This error occurs when once integer is stored for State/Province field, it can not be changed to alphanumeric .

Please go through this https://github.com/magento/magento2/issues/14052 .

You can fix this by making changes to the core file

Path magento_rootdirectory/vendor/magento/module-customer/Model/Address/AbstractAddress.php

line 650 function validate

change

elseif ($regionId && !in_array($regionId, $allowedRegions, true)) {

to

elseif ($regionId && !in_array($regionId, $allowedRegions, true) && !empty($allowedRegions)) {

Hope this helps .

Mac
  • 573
  • 5
  • 16
  • Thanks. Just checked out the page and it looks exactly like what I'm experiencing here. I'll make the change. – CJNotts Sep 12 '18 at 09:19
  • happy that it worked for you . – Mac Sep 14 '18 at 12:18
  • @RahulMakwana, this didn't work for me – Jafar Pinjar Dec 04 '18 at 07:31
  • @jafar I would like to help you out , are you getting the same error ? which version of magento ? – Mac Dec 04 '18 at 13:27
  • @RahulMakwana, I am using 2.2.4 – Jafar Pinjar Dec 04 '18 at 13:59
  • @jafar Hi I have tested the same in magento 2.2.4 as well its working for me after making the changes I suggested in the answer , Please look for any error logs and also check if any custom module is overriding magento_rootdirectory/vendor/magento/module-customer/Model/Address/AbstractAddress.php files validate() function , let me know I will be happy to help you. – Mac Dec 04 '18 at 15:12
  • @RahulMakwana, yes i have created the webapi, this is the link for the issue, you can check and post your answer there,, thanks https://magento.stackexchange.com/questions/240493/region-id-error-on-updating-address-using-address-id-in-magneto2 – Jafar Pinjar Dec 04 '18 at 15:15