2

I've a field in system.xml

    <field id="specificcountry" translate="label" type="multiselect" sortOrder="40" showInDefault="1" showInWebsite="1" showInStore="0">
    <label>Ship to Specific Countries</label>
<source_model>Magento\Directory\Model\Config\Source\Country</source_model>
    </field>

but how can i set the default value in config.xml, what is the syntax should be? like the following?

<default>
    <carriers>
        <mymodule>
             <specificcountry>HK,US,AU</specificcountry>
        </mymodule>
    </carriers>
</default>
3
  • you need three default values? – fmsthird Apr 11 '19 at 8:54
  • 1
    looks like you are doing it right. maybe you need to clear the cache or make sure that the tag under carriers is ok. – Marius Apr 11 '19 at 8:59
  • 1
    I can remember I run into the same issue before until I found out that there is already a value saved in my database which is overriding the default config settings. Try to remove it from the database and load again it will select all the defined default values – fmsthird Apr 11 '19 at 9:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.