Magento2 – Adding Section to Existing Tab in system.xml

adminhtmlmagento2system.xml

On

Stores -> Configuration -> Sales

i amtrying to add one more section there is no groups yet:

Lukas\DeliveryNotification\etc\adminhtml\system.xml

<?xml version="1.0"?>
<!--
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd">
<system>
    <section id="deliveryNotification" translate="label" type="text" sortOrder="300" showInDefault="1" showInWebsite="1" showInStore="1">
        <label>Shipping Notifications</label>
        <tab>sales</tab>
        <resource>Lukas_DeliveryNotification::lukas_deliveryNotification</resource>
    </section>
</system>

Lukas\DeliveryNotification\etc\acl.xml

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Acl/etc/acl.xsd">
<acl>
    <resources>
        <resource id="Magento_Backend::admin">
            <resource id="Magento_Backend::stores">
                <resource id="Magento_Backend::stores_settings">
                    <resource id="Magento_Config::config">
                        <resource id="Lukas_DeliveryNotification::lukas_deliveryNotification" title="Delivery Notification" />
                    </resource>
                </resource>
            </resource>
        </resource>
    </resources>
</acl>

But it does not get added, what is the problem?

Best Answer

First, verify your system.xml file is in etc/adminhtml folder

Second, notice resource parameter is missing in your code (not sure, if it's really required, but it seems so). Take a look at this references

https://www.mageplaza.com/magento-2-module-development/create-system-xml-configuration-magento-2.html

Magento 2 - How to add a custom store config in an existing tab?