Hello Magento Friends,

Today I am going to explain Magento 2: How To Setup Cron Time By Configuration

You can schedule cron dynamically with setup cron time by configuration. Sometimes developers set static time expressions to set cron in a custom module. So whenever the admin needs to make changes to the time expression, there is a need to change the crontab.xml file. Using the below steps the admin can quickly make changes to the time expression from the admin configuration and there is no need to make modifications in the crontab.xml file.

Let’s get started,

Steps to Setup Cron Time by Configuration in Magento 2:

Step 1:  First you need to add crontab.xml in the following path


Step 2:  Need to add a new group on system.xml in the following the path


Step 3: Now add Cronconfig.php in the following path


Step 4: Now add Cronfile.php in the following path



Hence, now all are able to Setup Cron Time by Configuration in Magento 2. In case of any difficulty let me know in the comment section below. Stay Safe, Stay Home, and Stay Updated!

Happy Coding

[Total: 3   Average: 5/5]