magento2
magento2 copied to clipboard
India lists only 1 region, it appears to use an odd file AddRegionsForIndia.php
Preconditions and environment
- Magento version 2.4.7-p2
Steps to reproduce
Select India, only 1 region appears - Ladakh
Expected result
Multiple regions displayed
Actual result
1 region appears - Ladakh
Additional information
It appears that a selection of India is using app/code/Magento/Directory/Setup/Patch/Data/AddRegionsForIndia.php I assume it should be using app/code/Magento/Directory/Setup/Patch/Data/AddDataForIndia.php (file also exists in same directory) as every other country appears to use this format. India appears to be some odd exception...
Release note
No response
Triage and priority
- [ ] Severity: S0 - Affects critical data or functionality and leaves users without workaround.
- [ ] Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
- [ ] Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
- [ ] Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
- [ ] Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.
Hi @devchris79. 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:
@magento give me 2.4-develop instance- upcoming 2.4.x release- For more details, review the Magento Contributor Assistant documentation.
- Add a comment to assign the issue:
@magento I am working on this - To learn more about issue processing workflow, refer to the Code Contributions.
Join Magento Community Engineering Slack and ask your questions in #github channel. :warning: According to the Magento Contribution requirements, all issues must go through the Community Contributions Triage process. Community Contributions Triage is a public meeting. :clock10: You can find the schedule on the Magento Community Calendar page. :telephone_receiver: The triage of issues happens in the queue order. If you want to speed up the delivery of your contribution, join the Community Contributions Triage session to discuss the appropriate ticket.
Hi @engcom-Bravo. 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:
- [ ] 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).
- [ ] 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue.
- [ ] 3. Add
Area: XXXXXlabel to the ticket, indicating the functional areas it may be related to. - [ ] 4. Verify that the issue is reproducible on
2.4-developbranchDetails
- Add the comment@magento give me 2.4-develop instanceto deploy test instance on Magento infrastructure.
- If the issue is reproducible on2.4-developbranch, please, add the labelReproduced on 2.4.x.
- If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here! - [ ] 5. Add label
Issue: Confirmedonce verification is complete. - [ ] 6. Make sure that automatic system confirms that report has been added to the backlog.
@magento give me 2.4-develop instance
Hi @devchris79. Thank you for your request. I'm working on Magento instance for you.
Hi @devchris79, here is your Magento Instance: https://425b33c70d326c1b721c9944d897ac48.instances-prod.magento-community.engineering Admin access: https://425b33c70d326c1b721c9944d897ac48.instances-prod.magento-community.engineering/admin_70cf Login: 60720acc Password: 7c09f3d9d112
The development instance doesn't show the issue, India has the regions in the shipping options. I wonder if its an issue when updating an instance of Magento.
Hi @devchris79,
Thanks for your reporting and collaboration.
We have verified the issue in Latest 2.4-develop instance and the issue is not reproducible.Multiple regions displayed
Could you please let us know from which version you have upgraded the instance and facing this issue.
Thanks.
Magento was updated from version 2.4.6 to 2.4.7, although the issue could have been present prior to that. I have manually injected regions into the database to correct for now.
@glo17720 (file author) Why is there two very similar files for adding regions to India, AddRegionsForIndia.php looks wrong with only Ladakh in the array as seen in our 2.4.7 site, where as AddDataForIndia.php looks correct.
Hi @devchris79,
Thanks for your update.
We are moving this issue On hold as we are discussing this issue with the Internal Team.
Thanks
Hi @devchris79,
We got reply from the internal team as follows :
In Magento 2, data patches are applied during bin/magento setup:upgrade. When a new data patch is added, Magento checks the patch_list table to see if it’s already applied. If not, it applies the patch.
If you modify an existing patch, it won’t reapply automatically. To reapply, you must delete the patch’s entry in patch_list or create a new patch file for additional changes.
The file AddDataForIndia.php is a data patch file that is applied once during installation.
To reapply the data patch with the newly added Ladakh region in the AddDataForIndia.php file, follow these steps:
Remove the entry for the AddDataForIndia patch from the patch_list table.
SET SQL_SAFE_UPDATES = 0;
DELETE FROM <root-directory-name>.patch_list WHERE patch_name = 'Magento\\Directory\\Setup\\Patch\\Data\\AddDataForIndia';
Delete the corresponding regions associated with India (to avoid duplicate regions when the patch is reapplied) from the directory_country_region table.
DELETE FROM <root-directory-name>.directory_country_region WHERE country_id = 'IN';
SET SQL_SAFE_UPDATES = 1;
Note: Being in production, deleting directly from SQL is not recommended.
This will force Magento to reapply the patch.
To avoid these steps, a new data patch, AddRegionsForIndia, has been added with the new region, Ladakh. This patch will be applied without affecting existing data.
Below are screen recordings of regions in versions 2.4.6 and 2.4.7, showing that regions are unaffected after upgrading from 2.4.6 to 2.4.7.
https://github.com/user-attachments/assets/9bd5abf5-0979-4dda-98d4-76499122fc00
https://github.com/user-attachments/assets/25c2ddc2-b442-49df-91ae-c0d3bce3cab8
verified it by upgrading from 2.4.6 to 2.4.7. Issue is not reproducible.Hence we are closing this issue.
Thank