magento / magento2

Prior to making any Submission(s), you must sign an Adobe Contributor License Agreement, available here at: https://opensource.adobe.com/cla.html. All Submissions you make to Adobe Inc. and its affiliates, assigns and subsidiaries (collectively “Adobe”) are subject to the terms of the Adobe Contributor License Agreement.
http://www.magento.com
Open Software License 3.0
11.55k stars 9.32k forks source link

[BUG]: Guam is both a state of the US and a country. #38378

Closed damienwebdev closed 9 months ago

damienwebdev commented 9 months ago

Preconditions and environment

In the Magento database, Guam is listed both as a country on its own as well as a state of the US.

Country: https://github.com/magento/magento2/blob/03621bbcd75cbac4ffa8266a51aa2606980f4830/app/code/Magento/Directory/Setup/Patch/Data/InitializeDirectoryData.php#L145

State: https://github.com/magento/magento2/blob/03621bbcd75cbac4ffa8266a51aa2606980f4830/app/code/Magento/Directory/Setup/Patch/Data/InitializeDirectoryData.php#L332

However, only the "state" Guam works with USPS when calculating rates.

Additionally, Guam is considered a country in GraphQl here.

Steps to reproduce

  1. Enable USPS rate calculation
  2. Set a Guam address on your cart with Guam as a country
  3. Calculate rates
  4. See no rates available.
  5. Set a Guam address on your cart with United states as a country and Guam as a state.
  6. See rates.

Expected result

I expect to be able to set my Guam address on my cart without in one way that works.

Actual result

I sometimes get rates, other times I don't.

Additional information

Here is a related issue. https://github.com/magento/magento2/issues/35610

I suspect entirely removing Guam as a country is the appropriate method. Additionally, this mandates setup patches to migrate existing customers in Guam to the US on top of removing Guam as a country.

These are the approximate appropriate steps to take.

DELETE from directory_country where country_id = "GU";

-- Get region id
SELECT @guamRegion := `region_id` FROM directory_country_region where country_id = "US" and code = "GU";

UPDATE customer_address_entity SET country_id='US', region_id=@guamRegion where country_id = "GU";
UPDATE quote_address SET country_id='US', region_id=@guamRegion where country_id = "GU";
UPDATE sales_order_address SET country_id='US', region_id=@guamRegion where country_id = "GU";

Release note

Customers that live in Guam can now purchase items from Magento stores without grief.

Triage and priority

m2-assistant[bot] commented 9 months ago

Hi @damienwebdev. Thank you for your report. To speed up processing of this issue, make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, Add a comment to the issue:

m2-assistant[bot] commented 9 months ago

Hi @engcom-Dash. Thank you for working on this issue. In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:


engcom-Dash commented 9 months ago

@magento give me 2.4-develop instance

magento-deployment-service[bot] commented 9 months ago

Hi @engcom-Dash. Thank you for your request. I'm working on Magento instance for you.

magento-deployment-service[bot] commented 9 months ago

Hi @engcom-Dash, here is your Magento Instance: https://22d61490e580ec52e5ecd2b4fe8b3db7.instances-prod.magento-community.engineering Admin access: https://22d61490e580ec52e5ecd2b4fe8b3db7.instances-prod.magento-community.engineering/admin_aedd Login: 79e92bbb Password: 04105a6b01dc

engcom-Dash commented 9 months ago

Hi @damienwebdev

Thanks for reporting and collaboration.

Verified the issue on magento 2.4 dev instance but the issue is not reproducable.

We are seeing calculated shipping rates when the country is guam and when the country is US and state is guam.

Please refer the attached screenrecording.

https://github.com/magento/magento2/assets/60198592/7d7be1eb-0699-4472-a702-c7cb96a903ec

Please verify the issue in magento 2.4 dev instance and let us know if we missed anything and if you are still facing the issue.

engcom-Dash commented 9 months ago

Hi @damienwebdev

We have noticed that this issue has not been updated since long time.
Hence we assume that this issue is fixed now, so we are closing it. Please feel to raise a fresh ticket or reopen this ticket if you need more assistance on this.

Thanks