The Complete Shopware 6 Scheduled Task Guide — Cron Jobs 2026

CodeAtoZ Engineer, CodeAtoZ
11 min read · 2001 words
Share: 𝕏 in
SHOPWARE 6 · DEV SERIES #5

The Complete Shopware 6 Scheduled Task Guide — Cron Jobs 2026

Build reliable background jobs with Shopware 6 scheduled task — task class, handler registration, async message handlers, intervals, and the task management console.

Crontime-based tasks
Queueasync jobs
15 mindefault interval
2026updated
In this guide
Task classHandler registrationservices.xmlAsync messagesIntervalsConsole commands

A Shopware 6 scheduled task is the platform-native way to run background jobs on a time-based schedule — syncing data, cleaning up stale records, sending digest emails, or polling external APIs. Unlike raw cron jobs on the server, a Shopware 6 scheduled task is managed by the Shopware task runner, registered in the DI container, and visible in the admin under Scheduled Tasks. This guide covers the full implementation from task class to handler, services.xml registration, and async message queue integration.

Shopware 6 uses a two-layer background job system. The first layer is the Shopware 6 scheduled task — a time-based runner that executes at a configured interval. The second layer is the Symfony Messenger queue — asynchronous message handlers that process jobs dispatched at any point. For heavy operations, the best pattern is a Shopware 6 scheduled task that enqueues messages, with a separate MessageHandler doing the actual work. This keeps the scheduled task fast and lets the message queue scale the processing load.

shopware 6 scheduled task diagram — task class, handler, async message queue by CodeAtoZ
Shopware 6 scheduled task — task class, handler registration, services.xml, async message queue by CodeAtoZ
01

Shopware 6 Scheduled Task: Creating the Task Class

A Shopware 6 scheduled task requires two classes: the task definition and the handler. The task definition extends AbstractScheduledTask and declares the task name and default interval in seconds. Register it in services.xml with the shopware.scheduled.task tag. After running bin/console cache:clear and bin/console scheduled-task:register, the task appears in the Shopware admin under Settings → System → Scheduled Tasks. Refer to the Shopware 6 scheduled task documentation for the official implementation reference.

PHP · SCHEDULED TASK CLASS
namespace MyPluginScheduledTask;
use ShopwareCoreFrameworkMessageQueueScheduledTaskScheduledTask;
class ProductSyncTask extends ScheduledTask {
    public static function getTaskName(): string { return "my_plugin.product_sync"; }
    public static function getDefaultInterval(): int { return 900; } // 15 minutes
}
XML · SERVICES.XML REGISTRATION
<service id="MyPluginScheduledTaskProductSyncTask">
    <tag name="shopware.scheduled.task"/>
</service>

<service id="MyPluginScheduledTaskProductSyncTaskHandler">
    <argument type="service" id="scheduled_task.repository"/>
    <argument type="service" id="MyPluginServiceProductSyncService"/>
    <tag name="messenger.message_handler"/>
</service>
02

Shopware 6 Scheduled Task: The Handler Class

The handler for a Shopware 6 scheduled task extends AbstractScheduledTaskHandler. Override run() with the actual logic. The handler automatically updates the task’s last run time and next execution time in the database. For operations that may take longer than a few seconds, dispatch a Symfony Messenger message from within run() instead of doing the work directly — this keeps the Shopware 6 scheduled task runner fast and non-blocking. The Messenger queue processes the heavy work asynchronously in a separate worker. Check the Shopware 6 developer documentation for the full AbstractScheduledTaskHandler API.

⚠
Common Mistake

Never run heavy operations — external API calls, bulk database writes, file processing — directly in the Shopware 6 scheduled task handler’s run() method. If the task exceeds the PHP execution timeout, it is marked as failed and Shopware may increase the retry interval. Dispatch a Messenger message instead and let the queue worker handle the load asynchronously.

03

Shopware 6 Scheduled Task: Console Management

  • bin/console scheduled-task:list — view all registered tasks and their next run time
  • bin/console scheduled-task:run — run all due tasks immediately
  • bin/console messenger:consume default — start consuming the async message queue. See the Symfony Messenger documentation for advanced queue configuration
  • bin/console cache:clear — required after any services.xml change
  • Admin panel: Settings → System → Scheduled Tasks — view, enable/disable, trigger manually
  • Set SHOPWARE_HTTP_CACHE_ENABLED=0 in .env during development to see task updates immediately
  • Production: use Supervisor to keep messenger:consume running as a daemon process

Our Shopware development team builds production plugin architectures with full scheduled task, message queue, and event subscriber integration for complex sync and automation requirements.

❓

Frequently Asked Questions About Shopware 6 Scheduled Task

Q

What is a Shopware 6 scheduled task?

A Shopware 6 scheduled task is a background job that runs automatically at a configured time interval — similar to a cron job but managed by Shopware’s task runner. Tasks are defined as PHP classes extending AbstractScheduledTask, registered in the DI container, and visible in the Shopware admin under Settings → System → Scheduled Tasks.

Q

How do I create a Shopware 6 scheduled task?

Create a Shopware 6 scheduled task by defining two PHP classes: the task class extending AbstractScheduledTask (with getTaskName and getDefaultInterval methods), and the handler class extending AbstractScheduledTaskHandler (with the run() method). Register both in services.xml with the correct DI tags, then run bin/console cache:clear and bin/console scheduled-task:register.

Q

How do I set the interval for a Shopware 6 scheduled task?

Set the interval for a Shopware 6 scheduled task by returning the number of seconds from the getDefaultInterval() static method in your task class. For example, return 900 for 15 minutes, 3600 for hourly, and 86400 for daily. Merchants can override the interval in the Shopware admin under Settings → System → Scheduled Tasks after the task is registered.

Q

Can I run a Shopware 6 scheduled task manually?

Yes. Run a Shopware 6 scheduled task manually using bin/console scheduled-task:run from the command line, or trigger it from the Shopware admin panel under Settings → System → Scheduled Tasks. For development, use bin/console scheduled-task:run to execute all due tasks immediately without waiting for the next scheduled interval.

Q

What is the difference between a Shopware 6 scheduled task and a Messenger message?

A Shopware 6 scheduled task runs on a time-based interval via the task runner. A Symfony Messenger message is dispatched on demand and processed asynchronously by a queue worker. The recommended pattern for heavy operations is a scheduled task that dispatches Messenger messages, with the handler doing the actual work in a separate worker process to avoid blocking the task runner.

Q

How do I debug a failing Shopware 6 scheduled task?

Debug a failing Shopware 6 scheduled task by checking bin/console scheduled-task:list for the task status and last error, reviewing the Shopware log at var/log/prod-YYYY-MM-DD.log, and checking the admin panel under Settings → System → Scheduled Tasks. Ensure background workers are running with bin/console messenger:consume and that the DI container is cleared after any code changes.

Need a Shopware 6 Plugin with Scheduled Tasks?

Our team builds Shopware 6 plugins with full background job architecture — tasks, message queues, and event subscribers.

Scheduled tasksMessage queuesStore complianceFixed-price scoping
CodeAtoZ
Lead Engineer & Founder, CodeAtoZ

10+ years building Magento 2 and WooCommerce platforms for high-volume e-commerce businesses. Writes about performance engineering, plugin architecture, and scalable commerce systems.

Join the Discussion

Your email address will not be published. Required fields are marked *