How To Create Scheduled Tasks In Shopware Store

The Most Popular Extension Builder for Magento 2

With a big catalog of 224+ extensions for your online store

As your e-commerce company expands and orders begin to arrive on a regular basis, you may start to automate some of the operations that you would typically spend a few minutes on when processing each purchase, saving you time. In the long term, this may save you a substantial amount of time, allowing you to devote more attention to other aspects of your online store. That’s why today’s article will show you how to create scheduled tasks in the Shopware store - an essential update for your general operations.

An overview of scheduled tasks in Shopware

In general, when a user logs into the administration, many update operations in Shopware 6 are run on a regular basis as a background process in the browser (message queue). However, if a large number of people are working in the administration at the same time, this might result in performance degradation. In addition, there are specific tasks that should only be performed at specified times of the day or night. These operations are not carried out from the message queue. Scheduled tasks may be utilized to automate the completion of various chores without the need for human interaction.

Scheduled tasks in Shopware

For example, creating a sitemap or providing product data for comparison websites are examples of such tasks. The following configuration options are made directly on the server. Because the choices for server setup are dependent on the hoster, we will provide a broad explanation of this below. If you get any issues with the functioning of the server setup, you should be able to get answers from your hoster’s customer service department.

How to create scheduled tasks in the Shopware store

Modify scheduled tasks for regular execution

On the server, a cron job is created to execute the actions that have been scheduled. It is recommended that you schedule this to run every 5 minutes on a regular basis. In this case, the following command is used:

php /pfad/zu/Shopware/bin/console scheduled-task:run --time-limit=295 --memory-limit=512M

The inclusion of “—time-limit=295” guarantees that the command is performed for a total of 295 seconds after it has been sent. As a result, it will be completed when the fresh execution is launched after 5 minutes has passed. With the option “—memory-limit=512M,” the maximum amount of memory that this command may utilize is restricted to 512 MB, preventing the RAM from overloading.

Cron job is being used to create scheduled tasks in Shopware 6

The cron job configuration on the server might differ depending on the hosting provider. You should contact your web host for further information. Depending on how the server is configured, it may also make sense to delegate the above command’s execution to a script and include the script in the cronjob.

Configure messenger queue server-controlled processing

If you do not want the messenger queue to be processed by the browser’s background processes, the recommendations in the following two sections should be followed.

Deactivate admin worker

It is essential to make changes to the “shopware.yaml” file located in the /config/packages subdirectory of your Shopware installation to disable the standard worker’s execution (browser background process). If this file is not already present, it should be created. The following information will be recorded in the file:

shopware:
    admin_worker:
        enable_admin_worker: false

After that, it is crucial to clear the cache of the store. This may be accomplished via the use of a command that is executed directly on the server (e.g., via SSH):

php bin/console cache:clear

Create message queue for processing

The messages in the message queue should be processed continually. As a result, it is advised that you restart the command once every 5 minutes. In order to ensure that only a small number of parallel processes are performed in the long run as a result of the regular start, the running process may be stopped soon before the typical start with the inclusion of the parameter “—time-limit=295”:

php /pfad/zu/shopware/bin/console messenger:consume --time-limit=295

On the other hand, a memory limit may cause the process to be terminated at an early stage of development. As a result, a RAM restriction should not be implemented at this time.

Additional information from other hosters

Many web hosts give articles in their knowledge bases that describe how to get started there:

  • Profihost: More information regarding the setup may be found at Profihost, which can be found here.
  • Hetzner: The information is provided by Hetzner in this link.
  • Creoline: Creoline also provides additional guidelines here.

Profihost

3 Best plugins to create scheduled tasks efficiently in Shopware

Products and Layouts, Pages Scheduler

The Shopware 6 Products and Layouts, Pages Scheduler addon is used to schedule a product or a Layout/page to be functional from a specified day or within a date period. This is especially beneficial during the holiday season when a unique product or content page is published on a specified day. You may plan ahead of time for holiday seasons or limited-time deals in a very user-friendly way. It saves you time and relieves you of the pain of having to stay up at midnight to activate or disable goods or pages in the shop manually.

Products & Layouts/Pages Scheduler

Outstanding features:

  • Product schedules can be created by specifying the start and end dates.
  • Layouts can be published, and dates can be specified using this feature.
  • Make items accessible in your shop for special events and promotional deals, such as holidays.
  • The “Start Date” and “End Date” of schedules could be chosen successfully utilizing the date-pickers that have been provided.
  • It relieves you of the burden of manually activating and disabling goods, layouts, and pages, allowing you to sleep easily at night.

Price: €59 for an annual subscription.

Tabs Advanced - Manage all tabs in one place

The Tabs Advanced - Manage all tabs in one place plugin is the most outstanding detail page tab plugin with a powerful combination of features in a single package. Thanks to this module, you can totally customize the tabs that appear on the product detail page. You have the option of changing the default tabs or adding new ones. Shopware’s primary tabs are presented in the frontend when the installation has been completed. However, the setup may be confusing. Be sure to get in touch with the developers immediately if you encounter any difficulties during the installation process.

Tabs Advanced - Manage all tabs in one place

Outstanding features:

  • Tabs may be grouped or displayed individually on a single page to show standard Shopware material (such as item descriptions and characteristics, links to downloads, and ratings). Each tab may be restricted to particular articles or categories or hidden entirely for specific articles or categories only (Blacklist / Whitelist), depending on the configuration.
  • You may provide template files to use to design the content or output entirely yourself.
  • Create scheduled tasks to help you manage your tabs more efficiently.

Price: €149 for an annual subscription.

Scheduled Task Manager

In Shopware5, you could see a list of the cron jobs running in the backend. Background jobs in Shopware6 are now composed of Scheduled Tasks and a Message Queue, rather than just one or the other. Monitoring and regulating such background processes is critical for any shop administrator, but Shopware6 does not provide this functionality. There is a new Scheduled Tasks view where they can be watched and managed and a basic summary of the current condition of the MessageQueue, which is introduced by this plugin - Scheduled Task Manager.

Scheduled Task Manager

Outstanding features:

  • Scheduled Tasks can be managed in the administration.
  • Check the current state of the message queue.
  • View the content of the messages that have died.
  • Allows you to create goods and layouts for a defined period.
  • Product and layout-specific scheduling choices are available for each.

Price: €29 for an annual subscription.

Final Words

We hope this tutorial can help you understand how to create scheduled tasks in the Shopware store. A profitable enterprise rules the market. And, if you want to increase productivity and operate your e-commerce shop effectively while still enjoying independence and a lifestyle of your choosing, automation is a must-have tool. Your e-commerce firm can primarily function without you if you have well-planned Scheduled Tasks in place.

Increase sales,
not your workload

Simple, powerful tools to grow your business. Easy to use, quick to master and all at an affordable price.


Explore Our Products:

Subscribe

Stay in the know

Get special offers on the latest news from Mageplaza.

Earn $10 in reward now!

Earn $10 in reward now!

comment
iphone
go up