Set up the cronjob for product updates

Choose the right cronjob type for affiliate-toolkit – WordPress cron, external cronjob or WP-CLI – so prices, lists and feeds stay up to date.

The cronjob keeps your data current: it updates prices and availability of your products, reloads your lists and imports the feeds of your shops. If it does not run, your product boxes show outdated prices. You choose how it is triggered under affiliate-toolkit → Settings → General settings → cronjob type.

The status box below the setting shows when the cronjob last ran. If it ran within the last minutes, everything is fine.

WordPress Cronjob

The default. affiliate-toolkit registers its job in the WordPress scheduler every 10 minutes. WordPress only runs scheduled jobs when somebody visits your site – on a site with little traffic, updates can be delayed.

This is a good start for small projects. The plugin recommends it for up to about 1,000 products without price comparison.

Better: let your server call WordPress' scheduler regularly instead of relying on visitors. Most hosts offer this as "cronjob" in their control panel; you then call wp-cron.php of your site every few minutes.

External Cronjob

The external cronjob runs outside the WordPress scheduler and processes the updates step by step – the right choice for many products and lists.

  1. Set cronjob type to External Cronjob and save.
  2. Copy the URL shown below the setting. It contains a personal key (?key=…); calls without the correct key are rejected with "key invalid".
  3. In your hosting control panel, create a cronjob that calls this URL every 10 minutes.
The cronjob section of the general settings with the cronjob type set to an external cronjob, the cron URL to call and the update time window.
External cronjob with the URL to call.

On a server with shell access the cron entry looks like this:

*/10 * * * * curl -s "https://www.example.com/wp-content/plugins/affiliate-toolkit-starter/affiliate-toolkit-cron.php?key=YOURKEY" > /dev/null

External Cronjob + Output works the same way but prints progress messages and errors. Use it to test: open the URL in your browser and watch the output.

External cronjob via WP-CLI

With many products and lists, running the job through WP-CLI is the fastest option and does not tie up your web server. You need shell access and some server administration experience.

The base plugin includes the script affiliate-toolkit-wp-cli.php. Set the cronjob type to "External Cronjob" and run the script with wp eval-file:

*/10 * * * * cd /var/www/html && wp eval-file /var/www/html/wp-content/plugins/affiliate-toolkit-starter/affiliate-toolkit-wp-cli.php --url=https://www.example.com

Adjust the paths to your installation. The script raises the time limit to one hour, so a single run can process large queues.

Update time window and queues

With Productdata updates between you can limit updates to a time window, for example at night. If you use the same API keys on several sites, give each site its own window. Make sure the window is long enough for all products and lists – and that the cronjob is actually called during this time.

Every run is logged under affiliate-toolkit → Queues with status, number of entries and errors.

The Queues page lists every update run (WordPress cronjob, manual product and list updates) with status, number of entries, throughput, timestamps and runtime.
The queue overview with the update runs and their status.