Queues, workflows and webhook credentials can be created with XML provisioning, which is the way to set them up from outside the admin or copy a setup between stores. Put the tags inside a store-level Module tag for the Order Workflow module:
<Store code="YOUR_STORE_CODE">
<Module code="orderworkflow" feature="provision_store">
<!-- Queue, workflow and credential tags go here -->
</Module>
</Store>
Tag names aren’t case-sensitive. Provisioning can add and delete queues and workflows but not update them: to change a workflow, delete it and add it again.
Queues#
<Queue_Add>
<Code>ready_to_ship</Code>
<Name>Ready To Ship</Name>
</Queue_Add>
<Queue_Delete code="ready_to_ship" />
Code and Name are required. See Order queues for the rules.
Credentials#
<AuthenticationCredentials_Add>
<Description>ERP Webhook Login</Description>
<Type>Basic</Type>
<AuthenticationData>
<Username>miva</Username>
<Password>YOUR_PASSWORD</Password>
</AuthenticationData>
</AuthenticationCredentials_Add>
<AuthenticationCredentials_Update descrip="ERP Webhook Login">
<AuthenticationData>
<Password>NEW_PASSWORD</Password>
</AuthenticationData>
</AuthenticationCredentials_Update>
<AuthenticationCredentials_Delete descrip="ERP Webhook Login" />
Description, Type and Username are required when adding; the password is optional. In an update, every child is optional. Credentials that a workflow uses can’t be deleted.
Warning
Provisioning files with passwords in them are sensitive. Don’t commit them to source control or leave them on a server.
Workflows#
<Workflow_Add>
<Enabled>Yes</Enabled>
<Name>Queue Paid Orders</Name>
<WaitUntilTrue interval="5" maximum="60">Yes</WaitUntilTrue>
<Triggers>
<Trigger event="order_created" />
<Trigger event="order_total_change" />
</Triggers>
<Condition>
<ConditionExpression field="length(order:payments)" operator="GT" value="0" />
</Condition>
<Actions>
<Note_Add>Automated Workflow: order queued.</Note_Add>
<AddToQueue queue="ready_to_ship" />
</Actions>
</Workflow_Add>
<Workflow_Delete name="Queue Paid Orders" />
| Tag | Required | Notes |
|---|---|---|
Enabled |
Yes | Yes or No |
Name |
Yes | Must be unique |
WaitUntilTrue |
No | Text Yes or No. With Yes, interval and maximum (minutes) are required. Leave the tag out for no waiting. |
Triggers |
Yes | One or more <Trigger event="..."/>, using the codes in Triggers |
Condition |
No | See below |
Actions |
Yes | One or more of the action tags below |
Condition tags#
The children of Condition are combined with AND, like the top level of a workflow.
<Condition>
<ConditionExpression field="order:total" operator="GT" value="200" />
<ConditionGroup operator="OR">
<ConditionExpression field="order:ship_state" operator="IN" value="AK,HI" />
<ConditionExpression field="order:ship_cntry" operator="NE" value="US" />
</ConditionGroup>
<ConditionArrayGroup field="order:items" operator="ANY">
<ConditionExpression field="code" operator="LIKE" value="GIFT-%" />
</ConditionArrayGroup>
</Condition>
| Tag | Attributes |
|---|---|
ConditionExpression |
field, operator (an operator code from Conditions), value (not used by NULL, NOTNULL, TRUE or FALSE) |
ConditionGroup |
operator: AND or OR. Needs at least one child. |
ConditionArrayGroup |
field (a list, such as order:items), operator: ALL, ANY, FIRST, LAST or an element number. Child fields are relative to each element. Needs at least one child. |
Action tags#
| Tag | Example |
|---|---|
| Add to Queue | <AddToQueue queue="ready_to_ship" /> |
| Move to Queue | <MoveToQueue queue="successfully_retrieved_orders" /> |
| Remove from Queue | <RemoveFromQueue queue="new_and_updated" /> |
| Remove from All Queues | <RemoveFromAllQueues /> |
| Add Note | <Note_Add>Sent to the warehouse.</Note_Add> |
| Set Custom Field | <CustomField_Set module="customfields" field="exported">1</CustomField_Set> |
| Webhook | <Webhook method="POST" url="https://www.example.com/orders"><Credentials descrip="ERP Webhook Login" /></Webhook>. method is GET or POST; Credentials is optional and names existing credentials. |
| Payment Actions | <Payment capture_includes="shipped_shipments" refund_includes="received_returns" capture_enabled="Yes" refund_enabled="Yes" capture_nontax_charges="first" add_notes="Yes" /> |
| VOID | <Void add_notes="Yes" /> |
Queues and credentials named in actions must already exist, so put Queue_Add and AuthenticationCredentials_Add before the workflows that use them.
Payment attributes:
| Attribute | Required | Values |
|---|---|---|
capture_includes |
Yes | all, created_shipments, shipped_shipments |
refund_includes |
Yes | created_returns, received_returns |
capture_nontax_charges |
When capture_includes isn’t all |
first, last |
capture_dollars_within |
No | Amount, such as 0.50 |
capture_enabled, refund_enabled, refund_shipping_charges, refund_handling_charges, refund_payment_charges, refund_tax_charges, refund_other_charges, prorate_discounts, add_notes |
No | Yes or No (default No) |
See Payment actions for what each setting does.