pwa-studio
pwa-studio copied to clipboard
[bug]: Regions select stuck in loading state in checkout when US is disabled
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:
- Disable United States for the General > Country Options > Allow Countries configuration in admin
- Load checkout with a valid cart
- 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
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
- Join Magento Community Engineering Slack and ask your questions in #github channel.
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
@magento export issue to JIRA project PWA as Bug
@magento export issue to JIRA project PWA as Bug
:white_check_mark: Jira issue https://jira.corp.magento.com/browse/PWA-2836 is successfully created for this GitHub issue.
Able to reproduce issue by following steps as mentioned in description.
@adobe export issue to JIRA project PWA as Bug
:white_check_mark: Jira issue https://jira.corp.adobe.com/browse/PWA-3172 is successfully created for this GitHub issue.
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