pwa-studio icon indicating copy to clipboard operation
pwa-studio copied to clipboard

[bug]: Regions select stuck in loading state in checkout when US is disabled

Open justinconabree opened this issue 2 years ago • 5 comments

Describe the bug

When United States is not selected in the backend General > Country Options > Allow Countries configuration, the checkout fails to load the "States" field in the checkout. This is because it passes US to the GetRegions by default but this returns a graphql error when US is not active. When there is only one country available this causes the checkout to fully break as there's no way to trigger the load of the states.

To reproduce

Steps to reproduce the behavior:

  1. Disable United States for the General > Country Options > Allow Countries configuration in admin
  2. Load checkout with a valid cart
  3. Region select will be stuck with "Loading Regions..." and the GetRegions graphql will have returned an error

Expected behavior

Checkout uses an available country to fetch the regions to avoid errors.

Possible solutions

Use the General > Country Options > Default Country configuration value for the initial regions query and set the default selected country to that as well.

Debug Report

Please complete the following device information:

  • Device [e.g. iPhone6, PC, Mac, Pixel3]: PC
  • Browser [e.g. Chrome, Safari]: Chrome
  • Browser Version [e.g. 22]: 101
  • Magento Version [e.g Adobe Commerce 2.4]: 2.4.4
  • PWA Studio version: 12.4

Please let us know what packages this bug is in regards to:

  • [ ] venia-concept
  • [x] venia-ui
  • [ ] pwa-buildpack
  • [x] peregrine
  • [ ] pwa-devdocs
  • [ ] upward-js
  • [ ] upward-spec
  • [ ] create-pwa

justinconabree avatar May 02 '22 15:05 justinconabree

Hi @JustinConabreeAbsolunet. Thank you for your report. To speed up processing of this issue, make sure that you provided sufficient information.

Add a comment to assign the issue: @magento I am working on this


m2-assistant[bot] avatar May 02 '22 15:05 m2-assistant[bot]

Update

Changing the .env file's DEFAULT_COUNTRY_CODE to a country code that is allowed fixes the issue. Suggestion would be to make that default value fetched from a query on build time

Suggest changing type to enhancement/feature rather than bug

justinconabree avatar May 02 '22 16:05 justinconabree

@magento export issue to JIRA project PWA as Bug

anthoula avatar May 09 '22 14:05 anthoula

@magento export issue to JIRA project PWA as Bug

anthoula avatar May 16 '22 14:05 anthoula

:white_check_mark: Jira issue https://jira.corp.magento.com/browse/PWA-2836 is successfully created for this GitHub issue.

github-jira-sync-bot avatar May 16 '22 14:05 github-jira-sync-bot

Able to reproduce issue by following steps as mentioned in description.

Tarun50745 avatar Jul 20 '23 06:07 Tarun50745

@adobe export issue to JIRA project PWA as Bug

glo82145 avatar Jul 26 '23 05:07 glo82145

:white_check_mark: Jira issue https://jira.corp.adobe.com/browse/PWA-3172 is successfully created for this GitHub issue.

github-jira-sync-bot avatar Jul 26 '23 05:07 github-jira-sync-bot

Hi All,

as per testing issue is not reproducible hence we are closing this ticket. please feel free to reopen issue in case any updates or still reproducible.

Attachment

https://github.com/magento/pwa-studio/assets/84493875/b6818c16-e1ce-4547-9c92-7cc4205b52cd

glo42707 avatar Sep 04 '23 07:09 glo42707