4

I want to display list of country in my system.xml

<field id="country" translate="label" type="text" showInDefault="1" showInWebsite="1" showInStore="1">
    <label>Countries</label>
</field>

How we do this?

0

2 Answers 2

6

Use class Magento\Directory\Model\Config\Source\Country for country list

<field id="specificcountry" translate="label" type="multiselect" sortOrder="16" showInDefault="1" showInWebsite="1" showInStore="1">
    <label>Ship to Specific Countries</label>
    <source_model>Magento\Directory\Model\Config\Source\Country</source_model>
    <can_be_empty>1</can_be_empty>
</field>
0
-1
<field id="country" translate="label" type="select" sortOrder="20" showInDefault="1" showInWebsite="0" showInStore="0">
<label>Select Country</label>
<source_model>Magento\Directory\Model\Config\Source\Country</source_model></field>

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.