I have a multistore website in magento2 my stores are like A, B, C, D and its respective country is W, X, Y, Z and I have limited shipping like I want shipping only for four countries. suppose customer want order from website A then the country should be W, and the customer wants order from website B then the country should be X etc.

So I want country should be display based on entered website. On checkout page shipping address and billing address in magento2.

  • I don't get what you want. You can already update the customer adresses from your back office. And why removing the address access from the customer himself ?
    – Claims
    Commented Oct 14, 2021 at 15:20
  • @Claims, can you please check my above updated question. Commented Oct 16, 2021 at 5:55

1 Answer 1


From your updated question : It seems that all you want to do is to "print" the selectected available country based on your backend configuration.

All backend configurations are saved in the database in the table core_config_data so all you have to do it get it from there using scope config.

$this->scopeConfig->getValue(YOUR_VARIABLE_PATH, ScopeInterface::SCOPE_STORE);

I haven't check more than that but I suspect that the good path is general/country/allow

This is where you defined your allowed countries from your backend.

On the Admin sidebar, go to Stores > Settings > Configuration. In the left panel under General, choose General. Expand Expansion selector the Country Options section. Choose the Default Country where your business is located. In the Allow Countries list, select each country from which you accept orders.

To get the list; you can call this from your block into your template

public function __construct(
    /* Add below dependencies */
    \Magento\Directory\Model\AllowedCountries $allowedCountryModel
) {
    $this->allowedCountryModel = $allowedCountryModel;

//Call the below function to fetch countires        

Cf : https://magento.stackexchange.com/a/200368/89569

  • How to set the country value for front customer my account address section in Magento2 Commented Oct 18, 2021 at 13:54
  • @Webdeveloper Check updated answer
    – Claims
    Commented Oct 18, 2021 at 14:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.