# Scheduled task plugin

**URL:** <https://forum.shopware.com/t/scheduled-task-plugin/85972>\
**Category:** Shopware 6 (English)\
**Tags:** administration, programming\
**Created:** [15. März 2021 um 05:24 UTC](https://forum.shopware.com/t/scheduled-task-plugin/85972 "2021-03-15T05:24:19Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![SergejMelihov](https://avatars.discourse-cdn.com/v4/letter/s/ea666f/32.png) [@SergejMelihov](https://forum.shopware.com/u/SergejMelihov)\
**Post date:** [15. März 2021 um 05:24 UTC](https://forum.shopware.com/t/scheduled-task-plugin/85972/1 "2021-03-15T05:24:19Z")

</div>

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' ); } }
