Scheduled task plugin

When buy the product via PayPal, the payment status is changed to [in processing] but the order status is [open]. I am going to change order status from [open] to [in processing] when the payment status is [in processing].
So I made scheduled task plugin for this job.
In my plugin I implemented some query code to change order status.
But it is not working. I am not sure how I can do it. Please help me about this. Thank you

This is my scheduled task handler code

<?php declare(strict_types=1); namespace Change\OrderStatus\ScheduledTask; use Doctrine\DBAL\Connection; use Shopware\Core\Framework\MessageQueue\ScheduledTask\ScheduledTaskHandler; class ProcessOrderStatusHandler extends ScheduledTaskHandler { protected $connection; public function __construct( Connection $connection ) { $this->connection = $connection; } public static function getHandledMessages(): iterable { return [ ProcessOrderStatus::class ]; } public function run(): void { $this->connection->executeQuery( 'UPDATE `order` SET `order_number` = 111 WHERE `auto_increment` = 72' ); } }

Hi, I think you have started this the wrong way. You do not need a scheduled task for this. Instead, I would opt for a subscriber, that would be called, when the payment status is changed. I have actually tried to do this like that and it worked well for me. You can see the whole example on my Shopware blog here: How to change order states programmatically in Shopware 6 -