Visser Labs – WooCommerce Plugins

How To Export Via Manual CRON

Overview

Store Exporter Deluxe supports exporting via a command line request, to do this you need to prepare a specific URL and pass it the following required inline parameters.

Supported arguments

  • action: woo_ce-cron
  • type: Replace with the export type you wish to be exported, allowed export type values are listed below. (Defaults to empty)
  • key: If the secret key is filled by the store owner then only matching keys will result in a successful export. (Defaults to empty)
  • gui: Adding this parameter will display the CSV and any export errors in a formatted/friendly screen. (Defaults to 0)
  • response: – Adding this parameter controls how the export is returned, either as a simple success/fail response, raw CSV or CSV file download, allowed response values are listed below. (Defaults to empty)
  • format: Adding this parameter controls what export file format is returned, either csv by default or xml is supported. (Defaults to csv)
  • scheduled_export: Adding this parameter will override the CRON export with properties from the Scheduled Export Post ID. (Defaults to empty)
  • orderby: – Adding this parameter will override the default ordering for that export type, allowed response values are listed below. (Defaults to empty)
  • order: Adding this parameter will override the default ordering (e.g. ascending to descending) for that export type, allowed response values are listed below. (Defaults to empty)
  • to: Adding this parameter tells the exporter where to send the export depending on the required response (e.g. email, post, etc.). (Defaults to either Default Recipient for e-mail or Default Remote POST)
  • delimiter: Adding this parameter will override the default Field delimiter applied within the export. (Defaults to ‘,’ )
  • category_separator: Adding this parameter will override the default Category separator applied within the export. (Defaults to ‘|’ (vertical pipe))
  • bom: Adding this parameter will override the default BOM Character option within the export. (Defaults to 1)
  • encoding: Adding this parameter will override the default encoding option within the export. (Defaults to ‘UTF-8’)
  • limit: Adding this parameter will override any default limit of records to include in the export. (Defaults to empty)
  • offset: Adding this parameter will override any default records offset within the export. (Defaults to empty)
  • escape_formatting: Adding this parameter will override the default Escape Formatting option within the export. (Defaults to ‘all’)
  • header_formatting: Adding this parameter will override the default Header Formatting option applied to CSV/XLS exports. (Defaults to 1)
  • product_status: Adding this parameter will override the default Stock Status filter for Products within the export. (Defaults to any stock status)
  • order_items: Adding this parameter will override the default Order Items formatting option within the export. (Defaults to ‘unique’)
  • order_items_types: Adding this parameter will override the default Order Item Types formatting option within the export. (Defaults to ‘line_item’)
  • order_ids = Adding this parameter will return an export of matching Order ID’s (Post ID). (Defaults to empty)
  • order_payment = Adding this parameter will filter Orders by that payment gateway. (Defaults to empty)
  • order_product = Adding this parameter will filter Orders by the Product ID’s assigned to the Order Items. (Defaults to empty)
  • order_status = Adding this parameter will return an export of matching Order Status’s (Term slug). (Defaults to include all Order Status)
  • order_date_from = Adding this parameter and ‘order_date_to’ will return an export from that Order date. (Defaults to include all Order Date)
  • order_date_to = Adding this parameter and ‘order_date_from’ will return an export up to that Order date. (Defaults to include all Order Date)

Sample CRON exports

The following sample will generate an export of all Products and return it to the browser as a CSV download, no secret key is set for the store in this case.

http://www.domain-store.com/?action=woo_ce-cron&type=product&response=download

The same export as above but with a matching key provided by the store owner (e.g. 00000-00000-00000-00000).

http://www.domain-store.com/?action=woo_ce-cron&key=00000-00000-00000-00000&type=product&response=download

The following sample will trigger a Scheduled Export (Post ID: 100) to run immediately, note that the type and response attributes are still required even if they ignored once overidden by the Scheduled Export properties.

http://www.domain-store.com/?action=woo_ce-cron&key=00000-00000-00000-00000&type=product&response=download&scheduled_export=100

Allowed values

type

  • product
  • category
  • tag
  • brand
  • order
  • customer
  • user
  • coupon
  • subscription
  • product_vendor
  • commission
  • shipping_class

response

  • download – Returns a packaged export file download (with correct attachment headers) to the browser
  • raw – Returns the export file contents to the browser in raw format
  • url – Returns a public URL for the export file stored within WordPress Media
  • file – Returns the system path to the export file stored within WordPress Media
  • email – Send the generated export export via e-mail to an e-mail address, by default uses the Default Recipient setting, can be overridden by filling the to attribute
  • ftp – Uploads the generated export via FTP (login credentials and file path are set on the Settings screen)

format

  • csv – Returns a CSV formatted file
  • xml – Returns a XML formatted file
  • xls – Returns a Excel 2003 (XLS) formatted file
  • xlsx – Returns a Excel 2007 (XLSX) formatted file

scheduled_export

Any integer is accepted, must match the Post ID of an existing Scheduled Export configured from WooCommerce > Store Export > Settings > Scheduled Exports within the WordPress Administration.

orderby

Applies to Products, Orders.

  • ID
  • date
  • modified
  • rand
  • menu_order

Applies to Categories, Tags, Brands

  • id
  • name

order

  • ASC – List all records in an ascending order
  • DESC – List all records in a descending order

delimiter

Any string is accepted, recommended to provide a single character (e.g. ‘,’ (comma), etc.), this option is overridden for the XLS export format

category_separator

Any string is accepted, recommended to provide a single character (e.g. ‘|’ (vertical pipe), etc.)

bom

  • 1 (yes)
  • 0 (no)

encoding

Any supported character encoding is accepted. See the Encoding dropdown list on the Setting screen, or mb_list_encodings() on php.net for a complete list of accepted character encoding options. This option is overridden for the XLS and XLSX export format.

limit

Any integer is accepted.

offset

Any integer is accepted.

escape_formatting

  • all – Escape all cells
  • excel – Escape cells that contain special characters (e.g. comma, quotes, new lines, etc.) as Excel would with ‘text’ cells

header_formatting

  • 1 – Include export field headers
  • 0 – Disregard export field headers

stock_status

  • outofstock – Only include out of stock Products
  • instock – Only include in stock Products

order_items

  • unique – Place Order Items on individual cells within a single Order row
  • combined – Place Order Items within a grouped single Order row
  • individual – Place each Order Item within their own Order row

order_items_types

  • line_item – Include Products in the Order export as Line Items
  • coupon – Include Coupons in the Order export as Line Items
  • fee – Include Fees in the Order export as Line Items
  • tax – Include Tax in the Order export as Line Items
  • shipping – Include Shipping in the Order export as Line Items

order_ids

Any integer is accepted. Multiple Order ID’s can be provided by separating each Order ID with a ‘,’ (comma).

order_payment

Any payment gateway ID is accepted. Multiple payment gateways can be provided by separating each payment gateway with a ‘,’ (comma)

order_product

Any Product ID is accepted. Multiple Product ID’s can be provided by separating each Product ID with a ‘,’ (comma)

order_status

Any valid Order Status slug is accepted. Please note the different Order Status support between WooCommerce 2.2+ and legacy WooCommerce. Multiple Order Status can be provided by separating each Order Status with a ‘,’ (comma).

In WooCommerce 2.2+ the list of accepted Order Status are:

  • wc-pending
  • wc-processing
  • wc-on-hold
  • wc-completed
  • wc-cancelled
  • wc-refunded
  • wc-failed

For legacy WooCommerce (prior to WC 2.2) the list of accepted are:

  • pending
  • failed
  • on-hold
  • processing
  • completed
  • refunded
  • cancelled

order_date_from, order_date_to

Any valid d-m-Y date is accepted. For instance:

  • order_date_from: 15-01-2012
  • order_date_to: 31-01-2012

If the same order_date_from and order_date_to is provided (e.g. 04-07-2016) then the order_date_to is pushed to the next calendar day as we fetch Orders between midnight to midnight of the given date filter.

Was this article helpful?

Related Articles

Visser Labs – WooCommerce Plugins

© 2024 Rymera Web Co Pty Ltd. All Rights Reserved. All prices are in USD.