How to Disable Cron Job in Magento 2?

Although Magento and various Magento 2 extensions offer different cron jobs, sometimes you don't need all of them. This is exactly when you start wondering how to disable cron jobs in Magento. And how to do it easily.

So, here you'll learn about two ways of achieving that — programmatically and via the admin panel.

Disable Cron Job in Magento Programmatically

Unfortunately, Magento doesn't provide any options to disable cron jobs like plugin or observer. However, there still is a way.

To disable the cron job in Magento 2:

1. Create a custom module in your Magento installation.

2. Create a crontab.xml file in your custom module directory. 

3. Specify the time that doesn't exist — 0 0 30 2 * (February 30th) for the cron job you want to disable: 

<?xml version="1.0" ?>
    <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nonamespaceschemalocation="urn:magento:module:Magento_Cron:etc/crontab.xsd">
        <group id="default">
            <job name="indexer_reindex_all_invalid" instance="Magento\Indexer\Cron\ReindexAllInvalid" method="execute">
        <schedule>0 0 30 2 *</schedule>
    </job>
</group>
</config>

3. Save the file and run the following commands:

php bin/magento setup:upgrade
php bin/magento cache:clean

Disable Cron Job in Magento 2 Admin Panel

If you don't want to spend time editing code, try the Magento 2 Cron Schedule Extension

To disable a cron job in Magento 2 admin panel:

1. Navigate to System > Cron Schedule > Cron Jobs and find the cron job you'd like to disable. 

2. Tick the cron job and choose the Status > Disable option from the mass actions dropdown.

disable cron jobs magento 2

Once you click on a corresponding option the cron job you've selected will be disabled. 

disable cron magento

Additionally, you can run cron jobs manually from the same grid if you need to. Just select the ones you want and choose the Execute option from the mass actions. Or click on the Run Job button from the Actions column.