0

We started to have some issues with our quotes not being cleaned correctly.

I checked list of cron jobs and could not find sales_clean_quotes in the list.

We are currently running Magento 2.3.3. How can I force sales_clean_quotes to be run? Is there a setting somewhere that might be turned off?

Shopping cart settings look ok. Is there any other settings I need to configure for the cron task to be run?

Shopping Cart Settings

5
  • Does it work when you run the file manually? I mean you load the class and run the method manually
    – Jimmy
    Mar 19, 2021 at 2:14
  • @Jimmy I'm not sure how to manually run it. Is there a CLI command to spool up sales_clean_quotes? Mar 19, 2021 at 2:46
  • 1
    Do you know programing? If yes, please check this answer magento.stackexchange.com/a/96875/80023. If no then you can check var/log folder to see if any cron or general error there
    – Jimmy
    Mar 19, 2021 at 3:39
  • @KalvinKlien check my answer - magento.stackexchange.com/a/350118/3723 Nov 25, 2021 at 7:17
  • @KalvinKlien Also, you can check in your cPanel for cron setup is proper or not? php /home/<CPANEL USERNAME>/public_html/bin/magento cron:run > /home/<CPANEL USERNAME>/public_html/var/log/magento.cron.log Nov 25, 2021 at 8:35

2 Answers 2

2

You can run crons manually if you install the N98 Magerun tool for Magento 2 https://github.com/netz98/n98-magerun2.

The crons can individually be executed by running ./n98-magerun2.phar sys:cron:run <identifier>, which in your case, it will be:

./n98-magerun2.phar sys:cron:run sales_clean_quotes

without the n98 tool, you are not able to run an individual cron command on its own outside Magento's cron management.

1

You can run crons manually create one file like custom_cron.php in root directory of magento and set in cron as per your requirement but it's not good way for that but temporary solution.

Also, you have run one time then hit URL in browser for that as below.

https://example.com/custom_cron.php

<?php
error_reporting(E_ERROR | E_WARNING);
ini_set('display_errors', 1);
ini_set('max_execution_time','18000');
ini_set('memory_limit', '-1');
  
set_time_limit(0);
ini_set('memory_limit','2048M');
require 'app/bootstrap.php';
echo "start cron:----";
use Magento\Framework\App\Action\Context;
use Magento\Framework\App\Filesystem\DirectoryList;
use Magento\Framework\App\Response\Http\FileFactory;
use Magento\Framework\Filesystem;


class Customerreport
    extends \Magento\Framework\App\Http
    implements \Magento\Framework\AppInterface
{
    public function launch()
    { 
       
        $this->_state->setAreaCode(\Magento\Framework\App\Area::AREA_ADMINHTML);

       
       $myClass = $this->_objectManager->create('Magento\Sales\Cron\CleanExpiredQuotes');
       $myClass->execute(); 
       
        return $this->_response;
    }

}

$bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $_SERVER);
/** @var \Magento\Framework\App\Http $app */
$app = $bootstrap->createApplication('Customerreport');
$bootstrap->run($app);
echo "end cron:----";

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.