{"id":643,"date":"2019-10-21T06:08:41","date_gmt":"2019-10-21T06:08:41","guid":{"rendered":"https:\/\/meetanshi.com\/blog\/2019\/10\/21\/add-custom-entries-to-admin-system-configuration-in-magento-2\/"},"modified":"2025-05-22T15:32:07","modified_gmt":"2025-05-22T10:02:07","slug":"add-custom-entries-to-admin-system-configuration-in-magento-2","status":"publish","type":"post","link":"https:\/\/meetanshi.com\/blog\/add-custom-entries-to-admin-system-configuration-in-magento-2\/","title":{"rendered":"How to Add Custom Entries To Admin System Configuration in Magento 2"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Are you a Magento 2 developer that often tries his hands on developing extensions for custom functionalities? If so, you know how powerful is Magento 2\u2019s admin configuration. Like the feature for the admin to select the days of the week to book an appointment or offer delivery we need to <a href=\"https:\/\/meetanshi.com\/blog\/get-week-days-list-in-magento-2-system-configuration\/\">get week days list in Magento 2<\/a>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The custom module development may require to <strong>add custom entries to admin system configuration in Magento 2<\/strong> under Stores &gt; Configuration.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For example, creating custom dropdown or custom multi-select field as shown in the figure:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img decoding=\"async\" src=\"https:\/\/meetanshi.com\/blog\/wp-content\/uploads\/2019\/10\/How-to-Add-Custom-Entries-to-Admin-System-Configuration-in-Magento-2-1-1024x464.png\" alt=\"How-to-Add-Custom-Entries-to-Admin-System-Configuration-in-Magento-2-1.png\" class=\"wp-image-6697\" style=\"width:840px;height:auto\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">If you face a similar requirement, feel free to use the below solution:<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Steps to add custom entries to admin system configuration in Magento 2:<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">1. Create <em><strong>system.xml<\/strong><\/em>&nbsp;file at Vendor\/Extension\/etc\/adminhtml\/<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">&lt;?xml version=\"1.0\"?>\n&lt;config xmlns:xsi=\"http:\/\/www.w3.org\/2001\/XMLSchema-instance\"\n        xsi:noNamespaceSchemaLocation=\"urn:magento:module:Magento_Config:etc\/system_file.xsd\">\n    &lt;system>\n        &lt;tab id=\"vendor\" translate=\"label\" sortOrder=\"50\">\n            &lt;label>&lt;![CDATA[Vendor]]>&lt;\/label>\n        &lt;\/tab>\n        &lt;section id=\"vendor\" translate=\"label\" type=\"text\" sortOrder=\"40\" showInDefault=\"1\" showInWebsite=\"1\"\n                 showInStore=\"1\">\n            &lt;class>separator-top&lt;\/class>\n            &lt;label>Adding custom entries&lt;\/label>\n            &lt;tab>vendor&lt;\/tab>\n            &lt;resource>Vendor_Extension::config_extension&lt;\/resource>\n            &lt;group id=\"general\" translate=\"label\" type=\"text\" sortOrder=\"20\" showInDefault=\"1\" showInWebsite=\"1\"\n                   showInStore=\"1\">\n                &lt;label>General Configuration&lt;\/label>\n                &lt;field id=\"vendor_dropdown_custom\" translate=\"label comment\" type=\"select\" sortOrder=\"30\" showInDefault=\"1\" showInWebsite=\"1\" showInStore=\"1\">\n                    &lt;label>Vendor Custom Dropdown&lt;\/label>\n                    &lt;source_model>Vendor\\Extension\\Model\\Config\\Custom&lt;\/source_model>\n                &lt;\/field>\n                &lt;field id=\"vendor_multiselect\" translate=\"label comment\" type=\"multiselect\" sortOrder=\"40\" showInDefault=\"1\" showInWebsite=\"0\" showInStore=\"1\">\n                    &lt;label>Multiselect&lt;\/label>\n                    &lt;source_model>Vendor\\Extension\\Model\\Config\\Multiselect&lt;\/source_model>\n                &lt;\/field>\n            &lt;\/group>\n        &lt;\/section>\n    &lt;\/system>\n&lt;\/config><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">2. Create <em><strong>Custom.php<\/strong><\/em> file at Vendor\/Extension\/Model\/Config\/<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">&lt;?php\nnamespace Vendor\\Extension\\Model\\Config;\n\nclass Custom implements \\Magento\\Framework\\Option\\ArrayInterface\n{\n    public function toOptionArray()\n    {\n        return [\n            ['value' => 0, 'label' => __('First')],\n            ['value' => 1, 'label' => __('Second')],\n            ['value' => 2, 'label' => __('Third')],\n            ['value' => 3, 'label' => __('Fourth')]\n        ];\n    }\n}<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">3. Create <strong><em>Multiselect.php<\/em><\/strong>&nbsp;file at Vendor\/Extension\/Model\/Config\/<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">&lt;?php\nnamespace Vendor\\Extension\\Model\\Config;\n\nclass Custom implements \\Magento\\Framework\\Option\\ArrayInterface\n{\n    public function toOptionArray()\n    {\n        return [\n            ['value' => 0, 'label' => __('First')],\n            ['value' => 1, 'label' => __('Second')],\n            ['value' => 2, 'label' => __('Third')],\n            ['value' => 3, 'label' => __('Fourth')]\n        ];\n    }\n}<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">That\u2019s it to create the custom system.xml configuration in Magento 2. To make your extensions work expectedly certain configurations are made to have particular values for that you need to <a href=\"https:\/\/meetanshi.com\/blog\/set-default-values-for-magento-2-system-configuration\/\">set default values for system configuration in Magento 2<\/a>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Do share the solution with fellow developers via social media.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Thanks.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Are you a Magento 2 developer that often tries his hands on developing extensions for custom functionalities? If so, you know how powerful is Magento&#8230;<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[34],"tags":[],"class_list":["post-643","post","type-post","status-publish","format-standard","hentry","category-magento"],"acf":[],"_links":{"self":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/643","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/comments?post=643"}],"version-history":[{"count":3,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/643\/revisions"}],"predecessor-version":[{"id":15216,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/643\/revisions\/15216"}],"wp:attachment":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/media?parent=643"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/categories?post=643"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/tags?post=643"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}