Introduction to the WooCommerce Integration Tool
What is the WooCommerce Integration Tool?
The WooCommerce Integration tool allows communication between BPA Platform and WooCommerce®. All communication uses XML. You use the Integration tool to map BPA Platform data to WooCommerce objects and operations. Operations such as, ADD
, UPDATE
, GET
, and DELETE
, are eed for a variety of business objects, such as, Product, Customer and Order.
The XML responses received back from the WooCommerce API can be saved to file or passed to another BPA Platform tool for further processing. The responses can include details of the object requested, any errors from the provider, or the values of any automatically generated ID fields.
For example, you can use WooCommerce integration to provide an indirect link between systems that do not typically synchronise data with each other, such as synchronising contacts from a CRM platform as WooCommerce customers, importing WooCommerce sales orders into an ERP, or even to provide reports containing data from both systems.
Video Overview
White Paper - WooCommerce Integration Tool v1.0.18
ADD
, UPDATE
, GET
, and DELETE
are supported for a variety of business objects such as, Product, Customer, and Order.The WooCommerce Integration Tool Pack
The WooCommerce integration tool pack consists of:
- WooCommerce Integration — The Integration tool is a BPA Platform tool, used to communicate with the WooCommerce API. It must be installed on the BPA Platform server, and on any BPA Platform client machines. It is this that provides the translation between BPA Platform data and WooCommerce objects and operations.
System Requirements
The WooCommerce Integration tool requires BPA Platform (formerly “TaskCentre”) 4.6 build 1944 or above. This tool is compatible with WooCommerce versions 3.x.
Architecture
The diagram below provides a high-level system architecture overview of the WooCommerce Integration tool pack, with BPA Platform and the WooCommerce REST API.
Figure 1 — High-level system architecture of the WooCommerce Integration
About the WooCommerce Integration Tool
Global Configuration
The global configuration for this tool is used to create connections to WooCommerce.
Figure 2 — WooCommerce Integration – Global Configuration dialog
Click Add to create a connection to WooCommerce.
Use Extended Logging
Enabling this option exposes the XML parsed between WooCommerce Integration and the WooCommerce API. You can view the log from the BPA Platform Event Log (Manage > Event Log).
Without extended logging, the Event Log only contains start and end of transaction messages, plus any error messages encountered at runtime.
WooCommerce Connection Tab
You configure the connection to WooCommerce here.
Figure 3 — WooCommerce Integration – WooCommerce Connection Tab
Configure a meaningful Connection Name for this connection; this is the name displayed when adding tasks for WooCommerce.
Within Domain Name, specify the domain name of the URL to WooCommerce. For example, if the WooCommerce webshop is running on https://www.we-sell-clothes.co.uk/storefront
, the corresponding domain name is www.we- sell-clothes.co.uk.
Within Path, specify the path of the URL to WooCommerce. With the example above, this is storefront
.
By default, the connection to WooCommerce is over HTTPS, on TCP port 443
. Use Advanced to Set a Custom Port Number. You can also change the Authentication Type to Query Parameters here, when Basic
authentication is not working.
Figure 4 — Advanced Settings dialog
Authentication Tab
You can configure the WooCommerce credentials here that allow access to WooCommerce.
Figure 5 — WooCommerce Integration – Authentication Tab
Specify the Consumer Key and Consumer Secret created in WooCommerce.
Options Tab
By default, all WooCommerce objects are available for mapping to BPA Platform data. If required, you can reduce the number of available objects in the Options tab.
Figure 6 — WooCommerce Integration – Options tab
From the Module drop-down, select to show only WooCommerce Customers, Orders, or Products objects in the Mapping tab. The default is All objects.
Both version 2 and 3 of the WooCommerce API are supported in the WooCommerce Integration tool — from the Version drop-down, select the relevant API to connect to.
Test Connection
Using Test Connection allows you to test the connection to the WooCommerce API.
Skip SSL Certificate Check When Using HTTPS
Communication to WooCommerce is over HTTPS, which typically involves an SSL certificate. If required, enable Skip SSL certificate check when using HTTPS first — this is particularly useful if using a test (sandbox) environment on an internal server that doesn’t have a valid SSL certificate. By not selecting this option, a full connection test is performed.
Update Objects and Operations
Enabling the Update objects and operations option, allows the WooCommerce Integration schema within BPA Platform to be refreshed.
Step Configuration
When creating new tasks, the WooCommerce Integration tool is located under Data Connectors of the Task Browser.
General Tab
Use the General tab to name the BPA Platform data source to be mapped to the WooCommerce objects. The data source must be in XML form. To map BPA Platform recordsets, configure a Convert Recordset to XML step in the task before the WooCommerce Integration step, then select this as Task step.
Figure 7 — WooCommerce Integration – General tab
Provide a meaningful Name and Description for this step.
Choose your Data source. This can either be:
- No data source — If you don’t make use of a dedicated XML input source, select this option to use BPA Platform variables in place of the XML objects’ fields. These can then be mapped to operational fields.
For example, you can extract various bits of information from an email and store them in BPA Platform variables. Then, having mapped them to WooCommerce objects and operations, these can be stored in WooCommerce for later use. - Task step — The data source can be set to an available BPA Platform XML data source. Only those steps that are capable of natively exposing an XML document at runtime are listed. These may be another WooCommerce Integration step, or a tool such as Convert Recordset to XML.
- Custom schema — An XML schema defines the structure of the parsed XML: what tags are present, and the nesting of the tags. You Define the schema of the XML that will be used as the input data source for this step. The industry standard XSD format is used by the WooCommerce Integration tool. Any XML processed by this step must conform to this schema else an error will be reported.
If the XSD schema is available, either import it into the Custom Schema Configuration (use the Import XSD/XML File button) or copy and paste it into the configuration box.
If the XSD schema is not available, you can import an example of the runtime XML (Import XSD/XML File) or copy and paste it into the configuration box. Use the Parse button to create the schema.- Input source variable — As well as defining the schema, you must specify the BPA Platform variable that contains the XML data at runtime.
Connection Tab
You specify the WooCommerce Connection this step must use.
Figure 8 — WooCommerce Integration – Connection tab
All connections created in Global Configuration are presented here.
Alternatively, you can use a BPA Platform variable to create a dynamic connection, where the connection used is determined by runtime circumstances. At runtime, the contents of the variable must match the name of one of the Global Configuration connections — this is case-sensitive.
Mapping Tab
Here you define links between the incoming XML and the outgoing data that is sent to the WooCommerce API. This defines how, at runtime, the incoming XML is to be translated into the XML required for the relevant object and operation.
Figure 9 — WooCommerce Integration – Mapping tab
The Object drop-down shows the available objects. The Operation drop-down shows the operations available for the selected Object. For more information about which operation is available for an object.
You create the links by clicking and dragging an object field onto its corresponding operation field. Note that only linked fields are used in the output XML. BPA Platform formulas and variables can be included in the source data — drag them from the Task Browser to the object’s XML tree control. These can then be linked to operation fields. Note that BPA Platform recordsets must first be converted to XML using either the Convert Recordset to XML or Transform Data tool before they can be used here.
Each operation has an additional field, SupplementaryReference
, which allows for traceability when transferring data from one place to another. When mapped, the data resides locally at runtime. It is added to the output and creates a record for reference purposes only — you can choose to map any field to SupplementaryReference
to assist with checking where the data originated from or at what time the data transfer occurred, for example.
The WooCommerce Integration tool uses eXtensible Stylesheet Language Transformations (XSLT) to translate the received XML. The Advanced Translations (XSLT) tab shows the XSLT generated for the links created for the object and operation. Use Enable Free Type Mode to directly edit the XSLT — this is particularly useful when translating a nonstandard requirement.
Options Tab
The Options tab allows you to define how errors in this step are handled at task runtime.
Figure 10 — WooCommerce Integration – Options tab
If an error occurs, you can decide whether the step should Continue processing, or terminate the step immediately (Abort Step).
If the step is aborted, you can choose to Continue processing onto the next step in the task or terminate the whole task immediately (Abort Task).
Allowing the task to continue allows you to use the error XML received back from WooCommerce Integration in a Save File step for investigation purposes, for example.
All errors are recorded to the BPA Platform Event Log (Manage > Event Log).
Working with Other Steps
WooCommerce Integration can directly interact with the following steps:
Consuming XML from Other Tools
The WooCommerce Integration tool can consume objects outputted from the following tools:
Step Icon | Name | Step Type |
---|---|---|
Import Flat File | Input | |
Import XML Document | Input | |
Convert Recordset to XML | Format | |
Transform Data | Format | |
Call Task | Execute | |
WooCommerce Integration | Data Connectors |
WooCommerce Integration consumes the following objects exposed by other steps:
- XML — XML data from any BPA Platform tool capable of exposing XML (see above)
Exposing XML to Other Tools
Objects exposed by the WooCommerce Integration tool can be directly consumed by the following tools:
Step Icon | Name | Step Type |
---|---|---|
Convert XML to Recordset | Format | |
Run Microsoft Reporting Services | Format | |
Transform Data | Format | |
Save File | Output | |
Web Service Connector Toolk | Data Connectors | |
WooCommerce Integration | Data Connectors |
The WooCommerce Integration tool outputs the following objects which can be consumed by the above tools:
Figure 11 – WooCommerce Integration tool outputs
OutputData
The OutputData document contains:
- Data returned from WooCommerce Integration, for instance the created, updated or retrieved entity instances
SupplementaryReference
ErrorData
The ErrorData document is structured as follows:
<Error>
— All errors are created as an<Error>
node, with the following sub-nodes:
<Object>
— The name of the requested object, such as, Product<CODE>
— The error code returned by WooCommerce<MESSAGE>
— The corresponding error message<EXTENDEDINFO>
— A string containing additional information about the error<INPUTDATA>
— The input data mapped for the object, plus all data contained in the SupplementaryReference field
Both outputs can be used:
- Directly by subsequent tool steps which consume XML data inputs
- If required, use the Convert XML to Recordset tool to convert the XML to a BPA Platform recordset
- Accessed using the output or error objects for response data (
XmlString
), or the output or error schema (XmlSchema
) present in the Task Browser
Supported Objects
At the time of writing, the following objects and operations are supported:
WooCommerce Object | Standard Operations | ||||
---|---|---|---|---|---|
Get | Add | Update | Delete | Other | |
Customers: Customer | |||||
Orders: Order | |||||
Orders: Order note | |||||
Orders: Order refund | |||||
Products: Product | |||||
Products: Product attribute | |||||
Products: Product attribute term | |||||
Products: Product category | |||||
Products: Product shipping class | |||||
Products: Product Tag | |||||
Products: Product variation |
Runtime
The incoming XML is translated into the XML format for the object and operation selected in the configuration. The data for the linked fields is brought across into the output XML — only those fields that were linked are brought across. The XML is passed to the connector tool, which then:
- Processes the data
- Performs the operation requested
- Sends back an XML document containing the response
The XML can then be used by other BPA Platform steps
Error Handling
Errors are written to the BPA Platform Event Log (Manage > Event Log). You define how errors are handled in the Options tab of the WooCommerce Integration tool.
Reasons for the errors could include:
- Web service connection errors
- User privilege errors
- Errors from the WooCommerce API
- Warnings and messages from the WooCommerce API
WooCommerce Account Security
The WooCommerce API is the only method used to connect to WooCommerce and perform read / write tasks — all security present in the API is used.