Home > Docs > Import And Export WooCommerce Products Using Server Cron

Import And Export WooCommerce Products Using Server Cron

Last updated on December 11, 2024

A cron job is simply a scheduled task that runs regularly on your server. The Product Import Export for WooCommerce plugin helps you to automate all your exports and imports via FTP profiles and schedules. The two types of schedulers used by the plugin are:

  1. WordPress Cron
  2. Server Cron

Server cron

When the volume of data to be processed necessitates triggering the URL every minute, use server cron scheduling. This option is most preferred:

  • to generate a unique URL that can be added to your system in order to trigger the events. 
  • if you have a separate system to trigger the scheduled events.

Server cron scheduling on export

Scheduling the export via Server cron
Export Scheduling via server cron
  • File name : Specify a filename for the file you want to export.
  • Interval: Set the time interval for scheduling.
  • Start time: Schedule the time at which you want the automatic export to occur.

Click on Schedule Now. On saving, a Trigger URL will be generated.

Trigger URL generated on scheduling export
Trigger URL generated on scheduling export

Server cron scheduling on import

Scheduling the import via Server cron
Import Scheduling via server cron
  • Interval: Set the time interval for scheduling.
  • Start time: Schedule the time at which you want the automatic export to occur.

Click on Schedule Now. On saving, a Trigger URL will be generated.

Trigger URL generated on scheduling import
Trigger URL generated on scheduling import

One can view all the import/export scheduled operations under WebToffee import/Export (Pro)> Scheduled actions.

Know about more  Scheduled actions

Running server cron on different servers

Here, we have listed some servers and how to run server crons on them. 

cPanel

  1. In cPanel, under the Advanced section of the Main Page menu, select Cron Jobs.
  2. A new table will appear for setting time intervals and adding new scripts.
  3. For simpler configuration, the drop down menu has some common settings such as: Once Per Week or Once Per Day etc. We suggest you to select the time interval as Every minute.
    To customize the settings different from that of the drop-down menu, enter a time interval in the left side boxes or use the menus on the right to select from typical entries for each period.
  4. As the final step, enter the command or the path to your script in the Command field.
    setting time intervals
  5. Hit the “Add New Cron Job” button to save. The cron will run the script automatically at the selected intervals.

Example: The below-mentioned command is a combination of the trigger URL (fetched from the plugin: Product Import Export for WooCommerce ) and command. This is the command format followed in cPanel. To dump unwanted log files, simply add /dev/null.

Command:

curl-s“https://www.dogadorer.com/?wt_iew_url_cron=42&a=import&i=product&h=20aaa1505a97fb84434efd3502859671&t=1635935881” >/dev/null

Cloudways

  1. Log in the Cloudways platform.
  2. From the top menu bar, click on Applications.
  3. From the appearing list, select the application you want to set the cron for.
  4. Under Application Management, click on Cron Job Management section.
  5. Click on the ADD NEW CRON JOB button.
  6. Now, decide how often the cron job should run. You can either set it on your own or select the pre-defined values from the Common settings dropdown. However, we recommend you to select the time interval as Every minute.
  7. As the next step, set the type of script you want to run (PHP, curl, or wget) and the command to execute.
  8. Click on submit to save.
  9. The cron job will be listed in the BASIC tab once done.
  10. If you prefer to use command-line switches or other advanced cron settings, switch to the advanced editor under the Advanced tab.
    advanced tab

Example: Below mentioned is the command format in which cron runs in Cloudways. The command is a combination of the trigger URL(fetched from the plugin: Import Export Suite for WooCommerce ) and the command.

If you do not want to get emails when the script runs, simply add /dev/null 2>&1 at the end of the command.

Command:

wget-q-O-“https://www.dogadorer.com/?wt_iew_url_cron=42&a=import&i=product&h=20aaa1505a97fb84434efd3502859671&t=1635935881” >/dev/null 2>&1

EasyCron

EasyCron is a paid online service which allows user to specify the execution time of cron jobs in 3 ways:

  • Manually
  • By interval
  • By cron expression
  1. From your cron job dashboard, click on +Cron Job button.
  2. Enter the trigger URL in the field URL to call.
  3. Under When to execute, select Every minute.
    command in easycron
  4. Finally, click on the Create Cron Job button, and you are done!


Thus, you can run server cron jobs on different servers using the trigger URL generated using the Product Import Export Plugin for WooCommerce.