Magento2: List of allowed countries in checkout per website

Created on 1 Dec 2017  路  29Comments  路  Source: magento/magento2

Preconditions

Magento version 2.1.6 (clean version with sample data)
PHP version 7.0.25
MySQL 5.7.20

Steps to reproduce

  1. Create two websites, and set one of them as default
  2. Under Stores -> Configuration -> GENERAL -> General -> Country options -> Allow countries set different lists of allowed countries on default configuration level, and for every other created website. E.g for nl website:

nl_website

Expected result

  1. On nl website checkout page, list of allowed countries for that website should be displayed

Actual result

  1. Magento displays list of countries selected for the website that is set as the default one

countries_nl

Also, there is one more issue.
If now, from this list, I select lets say Turkey,
and then change the list of allowed countries for default website to something that doesn't contain that country, after refreshing the checkout page breaks. E.g

default_countries

broken_checkout

Fixed in 2.1.x Fixed in 2.2.x Fixed in 2.3.x Clear Description Format is valid needs update

All 29 comments

@VesnaS, thank you for your report.
The issue is already fixed in develop branch, 2.1.10, 2.2.1

Hi,

Am I the only one who still has the same bug in 2.2.3?

Thank you.

I'm still seeing this in 2.2.4

Hi,

After debugging a bit more, I found the source of my issue. There's a plugin in Magento_Customer's module : magento/module-customer/Model/Plugin/AllowedCountries.php::beforeGetAllowedCountries() that takes every country available if customer accounts are shared between websites, which was my case.

Maybe you have the same cofniguration @jsterling ?

Good spot, that's fixed it. Now all I need to sort is the default country not selecting...

Have the same problem magento 2.2.5
This was new install 2.2.3 updated tot 2.2.4 tot 2.2.5

different websites.
when setting share customer account to global some websites show countries that are not set.
Only solutions seems to be to set share customer to website as mentioned above

This is very annoying
Have m1 shop customers also shared and I can set websites to certain countries.

I'm also seeing this same issue in 2.2.2. As @Axel29 pointed out the beforeGetAllowedCountries plugin in the issue.

@magento-engcom-team Please reopen, this is not fixed in 2.2.6.

Confirming this is an issue in 2.2.2 and 2.2.5

Hi @AlexWorking. 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).
    DetailsIf the issue has a valid description, the label Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.
  • [ ] 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.

  • [ ] 3. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.

  • [ ] 4. Verify that the issue is reproducible on 2.3-develop branch

    Details- Add the comment @magento give me 2.3-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.3-develop branch, please, add the label Reproduced on 2.3.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. Verify that the issue is reproducible on 2.2-develop branch.

    Details- Add the comment @magento give me 2.2-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.2-develop branch, please add the label Reproduced on 2.2.x

  • [ ] 6. Add label Issue: Confirmed once verification is complete.

  • [ ] 7. Make sure that automatic system confirms that report has been added to the backlog.

Hi there @avstudnitz, @Radosav and the other members of this conversation. Seems this issue is sternly fixed in today's 2.2 and 2.3 develop versions as we've been not able to reproduce it on those versions. Could any of You please try to reproduce it Yourself on those versions asking the bot for clear instance leaving the comment like "@magento-engcom-team give me 2.3-develop" (just without quotes). Thank You.

Hello @VesnaS , @Axel29, @jsterling, @bobmats @KevinMace @avstudnitz, @Radosav

We have re-verified this issue and we cannot reproduce it on the latest 2.2-develop and 2.3-develop branches.
The issue was fixed and delivered recently. Fixes should be available with 2.3.3 and 2.2.9 releases.

But if it's still can be reproduced with different steps, feel free to add additional details and reopen it

Hi @sdzhepa is it possible to know what is the pull request where that fix is? We are running 2.3.1 and we would like to patch it now, instead of waiting for 2.3.3 release.

Hello @jbalca

Unfortunately, I do not have exact commits/PR with fixes.
I investigated and tried to find related tasks in internal Jira and through delivered PR based on keywords but without results.
I think it was fixed in the scope of another task(s).

We closed this issue based on several re-testing on the latest code bases. But if there are additional flows/cases that lead to the same problem, please add this information here and reopen this issue.

@sdzhepa the issue still occurs on 2.2.9 Enterprise version

Can you please supply us the link for the fix on github so we can double check if the fix is in 2.2.9 or not. From my perspective it is not fixed on 2.2.9 and this is a painful bug for front end users that effects conversion ratio's greatly.

May I know what is the expected behavior?
For me it would be like this:

  1. I create 2 websites: A and B. For A allowed country is the UK, for B allowed countries are DE and NL.
  2. When I am on A shop I can only select UK as a country, when I am in B shop I can select DE or NL.

Would that be expected for you too?

I do not understand the logic in magento/module-customer/Model/Plugin/AllowedCountries.php::beforeGetAllowedCountries(). Why we need to merge all those countries and show them all in all shops - if that would be desired then admin would select all 3 allowed countries for both Websites.

I reopened the issue to clarify that and keep the thread.

@krisdante for me this makes sense only in the customer account, not in the checkout.

If your websites A and B are on the same domain, share accounts, the customer has only ONE account dashboard, thus he must be able to create addresses for every allowed countries in both websites A and B.

But in the checkout, I agree that this should only take the countries allowed in the current website.

Well, actually he has two Dashboards - one for each store view (for each website) and still can be scoped there, even if login data are shared.
Of course, the shared address book is also an option, but how far we want to go then? Order history needs to be scoped per website (as assortment can differ)

I'm experiencing this issue on 2.3.2 (countries showing in the dropdown which are not allowed on the current website when customer scope is global).

I think an address in the address book which is not in the allowed country list should be disabled (so customer cannot select it to be used).
Customers will potentially have an address which is not in the allowed country list for the below reasons (i'm sure there are more)

  • Customer import
  • Allowed country list was updated after a customer created an account with an address country that was previously allowed

Hi @engcom-Delta. 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).
    DetailsIf the issue has a valid description, the label Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.
  • [ ] 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.

  • [ ] 3. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.

  • [ ] 4. Verify that the issue is reproducible on 2.3-develop branch

    Details- Add the comment @magento give me 2.3-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.3-develop branch, please, add the label Reproduced on 2.3.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: Confirmed once verification is complete.

  • [ ] 6. Make sure that automatic system confirms that report has been added to the backlog.

Hi @krisdante @Axel29 @helloeverything . Could you clarify: do you describe issue with customer address(Country) when set option Share Customer Accounts=Global?

Yes.
My desire is to have shared login and password across all the websites (shared user account), while each website has own limitation on shippings etc.

I know this is not so "USA" case, but here in Europe this is quite popular that each Country has own domain and shop with own sipping policies (therefore shipping is limited to selected countries).
But still this is one brand and since Magento offers the option to share user account - we would like to use this opportunity.
This way users from Germany can log in in Austrian shop, But Austrain shop does not ship to Germany. Those users needs to go to Austra to pick those things up.

Hi @engcom-Charlie. 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).
    DetailsIf the issue has a valid description, the label Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.
  • [ ] 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.

  • [ ] 3. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.

  • [ ] 4. Verify that the issue is reproducible on 2.3-develop branch

    Details- Add the comment @magento give me 2.3-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.3-develop branch, please, add the label Reproduced on 2.3.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: Confirmed once verification is complete.

  • [ ] 6. Make sure that automatic system confirms that report has been added to the backlog.

Hello @krisdante
I think it would be much better to open a new issue and continue there since the original issue was fixed, and you added a new step with the option Share Customer Accounts = Global.

Could you create a new issue with clear description of this problem?

Who can make some business decisions here?
The amount of work is rather big to fix this and I would need some vision from Magento so in the end this will not be rejected.

@krisdante i will approve your issue and try to move it forward to a quick solution

we are closing this issue due to inactivity. If you'd like to update it, please reopen the issue.

Problem is still there in 2.3.4.

Was this page helpful?
0 / 5 - 0 ratings