- 1 Overview
- 2 Creating a Scheduled Export using the Upload to remote FTP/SFTP Export Method
- 3 Troubleshooting
- 4 What do the different Export Formats within the Edit Scheduled Export screen mean?
- 5 What are time-dependent Scheduled Exports?
- 6 Triggering a Scheduled Export via a WordPress Action
- 7 Triggering a Scheduled Export via the manual CRON export engine
Store Exporter Deluxe uses the WordPress CRON (WP-Cron) engine to schedule single and recurring exports. Multiple Scheduled Exports can be configured to run at different intervals with their own filters, options and export field requirements.
Individual Scheduled Exports can be managed from the WooCommerce > Store Exports > Scheduled Exports screen.
Global Scheduled Exports settings can be managed from the WooCommerce > Store Exports > Settings > Scheduled Exports section.
Creating a Scheduled Export using the Upload to remote FTP/SFTP Export Method
Here’s a quick step-by-step tutorial on creating a new Scheduled Export that connects to an external FTP server and saves an Order export to a specific FTP directory and with a fixed export filename.
- Open WooCommerce > Store Export from the WordPress Administration
- Switch to the Scheduled Exports tab
- Beside the Scheduled Exports header click the Add New button
- Enter a title for the Scheduled Export (it is only used within the WordPress Administration)
- Within the Export Filters > General section set the following options:
- Export type to Orders
- Export format to Excel XLSX
- Export method to Upload to remote FTP/SFTP
- Without saving switch to the Method section
- Within the Export Filters > Method section set the following options:
- The Host field is required, this is the web address or IP address of your hosting server (e.g. 220.127.116.11 or ftp.google.com)
- The Port field is optional, some hosting servers require you to connect on specific ports (e.g. 2222)
- The Protocol field is required, you will be given different ways to connect to your hosting server. SFTP is recommended (more secure) while FTP is still common for many hosting servers. The SFTP option may be disabled if WordPress does not have the ability to connect using SFTP. Refer to the Troubleshooting section on this page and speak with your hosting provider.
- The Username field is required, this is the FTP/SFTP user login. This is not your WordPress Administration User login, speak with your hosting provider as they will create you an FTP/SFTP user account.
- The Password field is required, this is the FTP/SFTP user password. As above, this is not your WordPress Administration User password.
- The File path field is optional, setting this field means you can save exports to specific directories available to the FTP/SFTP user. This file path is relative to the base directory of the FTP/SFTP user and should not contain an opening ‘/’.In simple terms, when you connect to your hosting server using a FTP File Manager (e.g. FileZilla) the base directory is the opening directory shown when you connect to your hosting server. If you wanted to save exports to a directory named ‘exports’ within the WordPress Uploads directory you would enter:
- The Fixed filename field is optional, setting this field overrides the default Export filename set on the Settings tab of the opening Store Export screen. This is very handy for making the export filename relevant for individual Scheduled exports and can contain Tags, for instance:
- The Transfer mode field is optional and considered an advanced option.
- The Timeout field is optional and considered an advanced option.
- Click Publish to save the Scheduled Export
That’s it! Here’s some screenshots to better explain. 🙂
Failed scheduled exports are shown in several convenient places:
- under Recent Scheduled Exports on the WooCommerce > Store Exports > Scheduled Exports screen
- from the Recent Scheduled Export widget on the WordPress Administration Dashboard, and
- reported to the WooCommerce > System Status > Logs > woo_ce_… file.
We do our best to include a precise reason for failed Scheduled Exports and suggest remedies to resolve the issue. Viewing the WooCommerce logs is aimed at Advanced users.
Failed exports when exporting via FTP
Common FTP issues include:
- ftp_put: PORT command successful – you can try setting the Transfer Mode within Scheduled Exports > Method to Passive, otherwise you need to unblock the ports on your hosting server commonly used by the FTP protocol
- ftp_put: Failed to establish connection – you need to contact the FTP hosting provider to confirm working FTP connection details
- Could not upload %s to %s via FTP as the temporary export Post was not created – switch to ftp_fput upload method
If the above FTP issues persist you can try switching the FTP upload method. PHP comes with two methods – ftp_put() and ftp_fput() – use the following PHP snippet to override which FTP import method is used by the Scheduled Export and CRON export engines.
Failed exports when exporting via e-mail
If the Recent Scheduled Export widget shows a successful export and yet you have not received the scheduled export within your Inbox, try the following:
- check your Inbox Spam directory
- configure an additional e-mail recipient at another e-mail provider (e.g. @gmail.com, @outlook.com) to isolate your e-mail provider as the issue
It is common to experience mail issues on self-hosted e-mail setups where the hosting and e-mail server are located on the same physical server. This is best resolved by contacting your hosting provider.
Scheduled export e-mail of … returned false when sending to …, check if this message was received by the recipient(s)
As of the 2.1.10 Plugin release we check the response from woocommerce_mail() – or wp_mail() as a fallback – which can return false indicating there may have been an issue with sending of the Scheduled Export e-mail. There is no feedback from the WordPress mail engine so out of precaution we display a Scheduled Export error notice when this happens, it doesn’t necessarily mean that the Scheduled Export e-mail failed to be sent so if the Scheduled Export e-mail is being received by the recipient this notice can be disabled via the following PHP snippet.View Code
In the 2.1.11 Plugin release a WordPress Administration notice will be displayed on the first time a Scheduled Export e-mail returns the above false response with a prompt to ignore future Scheduled Export error notices for this type of warning.
Scheduled Export is published but not running
Common Scheduled Export execution issues include:
- The Scheduled Export is published but there is no notice of it running within the Recent Scheduled Exports dialog
- The Scheduled Export doesn’t run when clicking the Execute button from the Scheduled Exports screen
Note: Please see the below section What are time-dependent Scheduled Exports? before proceeding to understand how Store Exporter Deluxe’s Scheduled Export functionality integrates with WordPress.
What do the different Export Formats within the Edit Scheduled Export screen mean?
At the time of writing we support 5 different Export Formats for Scheduled Exports which decides what Store Exporter Deluxe does with the exported file. By default we save the export file to the WordPress Media for archival purchases. The different Exports Formats are listed below:
- Archive to WordPress Media
- Save to this server
- Send as e-mail
- POST to remote URL
- Upload to remote FTP/SFTP
Archive to WordPress Media
This Export Format takes the export file generated at the time of the Scheduled Export and saves it to the WordPress Media. You can view the contents of this export file by opening Media from the WordPress Administration menu or via the WooCommerce > Store Export > Archives screen.
Exports saved to the WordPress Media are physically saved to the WordPress Media directory configured for your WordPress site, by default this is /wp-content/uploads/… and depending on the Date Folder Indexing option on Settings > Media can be stored within sub-directories of this folder broken down by year and month (e.g. 2012/12/… or 2015/11/…).
Save to this server
This Export Format takes the export file generated at the time of the Scheduled Export and saves the resource outside the WordPress Media by providing a directory path and filename relative to the base WordPress directory (uses the WordPress Constant: ABSPATH). You cannot view the contents o this export file by opening Media from the WordPress Administration menu as this Export Method does to save exports to the WordPress Media system.
Send as e-mail
This Export Format takes the export file generated at the time of the Scheduled Export and if all required e-mail fields are set within the Method tab of the Edit Scheduled Export screen then prepares an e-mail and sends it to the provided recipient(s).
Multiple recipients can be set to receive each Scheduled Export. After an e-mail has been prepared and sent with the export file as a file attachment the physical export file is discarded from WordPress.
POST to remote URL
This Export Format takes the export file generated at the time of the Scheduled Export and uses the WordPress function wp_remote_post() to send the export file as a one-off form POST to a receiving server that is configured to accept POST files, this might be a supplier server, drop-shipping or accountant package.
Notice: This Export Format is often confused with our Upload to remote FTP/SFTP where users want to save the export file to a fixed location but misinterpret what this Export Format is intended for. This Export Format sends a POST form to the receiving server with the export file, nothing more.
Upload to remote FTP/SFTP
This Export Format takes the export file generated at the time of the Scheduled Export and depending on the Procotol selected from the Methods panel will connect to an external FTP or SFTP server and upload the export file.
The availability of different Protocols is dependent on different PHP packages – FTP and ssh2 – being available to WordPress, if we cannot detect a given PHP package then that Protocol will be disabled until it is available. Contact your hosting provider to enable missing PHP packages.
This Export Format has wide-ranging applications and supports fixed filename rules for persistent exports, for instance a static URL that a supplier reads on a daily basis.
What are time-dependent Scheduled Exports?
The Scheduled Exports feature within Store Exporter Deluxe uses the WordPress WP-CRON scheduler to schedule and execute tasks – in our case Scheduled Exports – at given times and at specific frequencies (e.g. at 9am daily).
The WP-CRON scheduler is dependent on regular screen loads, this means active site visitors viewing Posts and Pages or Users using the WordPress Administration, without this activity the WP-CRON scheduler will wait until the next screen load then execute any tasks which are due to be run. This can be problematic for users requiring a Scheduled Export to be run at a specific time at a given frequency (e.g. at 9am daily) but the given store does not receive a site visitor until 11am meaning our Scheduled Export is sent at 11am instead of the expected 9am.
In the above case where a user requires time-dependent Scheduled Exports we would advise them to configure a CRON task within their hosting panel to manually refresh WP-CRON and ensure that the Scheduled Export runs at the required time or consider triggering their Scheduled Export via a crafted WordPress Action listed below or using our CRON export engine. Contact your hosting provider for assistance configuring CRON tasks within your hosting panel.
We have recently added WP-CLI export support enabling store owners to list and trigger the execution of one-time Scheduled Exports.
Supported WP-CLI commands include:
- wp store-export list
- wp store-export scheduled_export –scheduled_id=000
Triggering a Scheduled Export via a WordPress Action
Below is an experimental solution to trigger a Scheduled Export to run immediately by passing a unique URL to WordPress. You’ll need to add a WordPress Action to your current WordPress Theme’s functions.php.
Note: Change the secret_key variable before deploying to a live store environment.View Code
Triggering a Scheduled Export via the manual CRON export engine
You can trigger a Scheduled Export to run immediately by passing a unique URL to WordPress. This solution uses the manual CRON export engine included with Store Exporter Deluxe and does not require adding a WordPress Action to your current WordPress Theme’s functions.php
- Open the WooCommerce > Store Export > Scheduled Exports screen and copy down the Post ID of the Scheduled Export you want to run
- Open the WooCommerce > Store Export > Settings screen and within the CRON Exports section set the Enable CRON export option to Enabled
- Ensure the Secret Key field is filled and copy down the Secret Key value as it will be required later; the Secret Key value is case sensitive
- Click Save Changes to enable the CRON export engine
- Within a text editor prepare a URL to trigger the manual CRON export engine.In this example the Scheduled Export has a Post ID of “100” and a Secret Key value of “00000-00000-00000-00000”.
WordPress Site URL: http://www.domain-store.com
(Replace this with your WordPress Site URL)
Scheduled Export Post ID: 100
(Replace this with the Post ID of your Scheduled Export)
Secret Key: 00000-00000-00000-00000
(Replace this with your Secret Key value)
Note: The type and response arguments are required to be filled but are ignored by the CRON export engine as it uses the details from your Scheduled Export
- Paste the URL into your browser to trigger the export
- Open the WooCommerce > Store Export > Scheduled Exports screen, within the Recent Scheduled Exports dialog you should see a “Scheduled Export completed” notice
That’s it. 🙂