Hello
I'm working on Magento 2.4 and I was creating a custom field in system.xml. I want to set the default value of this field as the URL of the store. How can do that?
Thank you
Hello @sqirnasgma7178
Yes, you can create config.xml and stores the default value. Please follow the steps below:
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Store:etc/config.xsd">
<default>
<section_id>
<group_id>
<field_id>ADD_URL_HERE</field_id>
</group_id>
</section_id>
</default>
</config>Please replace section_id, group_id & field_id as per your module system.xml file. (system.xml file path /app/code/Vendor/Module/etc/adminhtml/system.xml)
If you find our reply helpful, please give us kudos.
A Leading Magento Development Agency That Delivers Powerful Results, Innovation, and Secure Digital Transformation.
WebDesk Solution Support Team
Get a Free Quote | | Adobe Commerce Partner | Hire Us | Call Us 877.536.3789
Thank You,
WebDesk Solution Support Team
Get a Free Quote | Email | Adobe Commerce Partner | Hire Us | Call Us 877.536.3789
Location: 150 King St. W. Toronto, ON M5H 1J9