Open schnere opened 8 months ago
Hi @schnere. 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@magento I am working on this
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.
This patch solves the problem in my case:
diff --git a/vendor/magento/module-directory/Model/ResourceModel/Country/Collection.php b/vendor/magento/module-directory/Model/ResourceModel/Country/Collection.php
index d84b11fc..545db027 100644
--- a/vendor/magento/module-directory/Model/ResourceModel/Country/Collection.php
+++ b/vendor/magento/module-directory/Model/ResourceModel/Country/Collection.php
@@ -293,19 +293,14 @@ class Collection extends \Magento\Framework\Model\ResourceModel\Db\Collection\Ab
*/
private function addDefaultCountryToOptions(array &$options)
{
- $defaultCountry = [];
- foreach ($this->storeManager->getWebsites() as $website) {
- $defaultCountryConfig = $this->_scopeConfig->getValue(
- \Magento\Directory\Helper\Data::XML_PATH_DEFAULT_COUNTRY,
- ScopeInterface::SCOPE_WEBSITES,
- $website
- );
- $defaultCountry[$defaultCountryConfig][] = $website->getId();
- }
+ $defaultCountry = $this->_scopeConfig->getValue(
+ \Magento\Directory\Helper\Data::XML_PATH_DEFAULT_COUNTRY,
+ ScopeInterface::SCOPE_STORE
+ );
foreach ($options as $key => $option) {
- if (isset($defaultCountry[$option['value']])) {
- $options[$key]['is_default'] = !empty($defaultCountry[$option['value']]);
+ if ($defaultCountry == $option['value']) {
+ $options[$key]['is_default'] = true;
}
}
}
Hi @engcom-November. 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:
Area: XXXXX
label to the ticket, indicating the functional areas it may be related to.2.4-develop
branch@magento give me 2.4-develop instance
to deploy test instance on Magento infrastructure. 2.4-develop
branch, please, add the label Reproduced on 2.4.x
.Issue: Confirmed
once verification is complete. Hello @schnere,
Thank you for the report and collaboration!
Verified this issue on 2.4-develop. When the base store is set to DE where region is made hidden, and the sub store set to US with region as required. In the checkout page of sub store the region was not displayed.
Please take a look at the screenshot below:
Here it can be seen that region/state field is absent.
Hence confirming this issue.
Thank you.
:white_check_mark: Jira issue https://jira.corp.adobe.com/browse/AC-11050 is successfully created for this GitHub issue.
:white_check_mark: Confirmed by @engcom-November. Thank you for verifying the issue.
Issue Available: @engcom-November, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.
Preconditions and environment
Steps to reproduce
Add a product in US substore to cart, go to checkout shipping page.
Expected result
For US substore the region field should be displayed in checkout because the field is required.
Actual result
The region field is hidden.
Additional information
The problem is that the options for both countries are set to
is_default
. The issue is caused in this line: https://github.com/magento/magento2/blob/594a590b6f3821d49a3ecc98d5c4d5336a0b4d04/app/code/Magento/Directory/Model/ResourceModel/Country/Collection.php#L303The region element then only checks the first country it finds with
is_default
set: https://github.com/magento/magento2/blob/594a590b6f3821d49a3ecc98d5c4d5336a0b4d04/app/code/Magento/Ui/view/base/web/js/form/element/region.js#L34As
DE
is in alphabetical order beforeUS
this option will be used which causes the region field to be hidden.Release note
No response
Triage and priority