Created by potrace 1.16, written by Peter Selinger 2001-2019

Miva Developer Docs


Each example lists the queue it needs, then the workflow: triggers, conditions and actions. The same setups can be provisioned.

Send paid orders to an ERP, with acknowledgement#

The ERP pulls new and changed orders and confirms each one it saves. This is the default setup; enable the three default workflows named in Retrieving orders from a queue.

Workflow Triggers Conditions Actions
Process New & Updated Orders Order Created, Order Total Change, Order Item Created, Order Item Updated, Order Item Deleted length(order:payments) Greater Than 0, Wait Until True every 5 minutes for 60 Add Note, Add to Queue new_and_updated
Process Retrieved Orders with Order Acknowledgement Order Retrieved Add Note
Process Order Acknowledgement Order Acknowledged Add Note, Move to Queue successfully_retrieved_orders

The payment condition with Wait Until True holds back orders being built in the admin until they’re paid.

Next day air orders first#

Queue: next_day_air (Next Day Air). The warehouse works this queue before the others.

Triggers Conditions Actions
Order Created order:ship_method Contains Next Day, Wait Until True every 5 minutes for 60 Add to Queue next_day_air
Order Shipment Status Change List Condition on order:items, All: status Equal To 200 Remove from Queue next_day_air

Make these two workflows. The second takes the order out of the queue once every item has shipped (item status 200).

Hold large orders for review#

Queue: review (Fraud Review).

Triggers Conditions Actions
Order Created order:total Greater Than 1000 Add to Queue review, Add Note “Held for review: order over $1,000.”

Customer service clears the queue from the order’s Order Workflows tab once each order is checked. To keep these orders away from an ERP until they’re cleared, add order:CustomField_Values:orderworkflow:review Empty to the conditions of the workflow that queues orders for the ERP. A cleared order joins the ERP queue the next time one of that workflow’s triggers fires, or add it by hand on the Order Workflows tab.

Capture payment as items ship#

Captures each shipment’s amount when it ships, and captures any small remainder with the last one.

Triggers Conditions Actions
Order Shipment Status Change Payment Actions: Capture on, Collected Amount Includes Amount Of All Shipped Shipments, Capture Non-Tax Charges First, Within X Dollars 0.50, Add Payment Operation Notes on

Shipping and other order charges go with the first capture. Each run captures only the difference from what’s already been captured, so running it again on the same order is safe.

Refund received returns#

Triggers Conditions Actions
Order Return Status Change Payment Actions: Refund on, Collected Amount Excludes received returns, Refund Order Charges When Entire Order Is Returned: Shipping on, Add Payment Operation Notes on

Refunds happen when a return is marked received, not when the RMA is issued. If every item comes back, shipping is refunded too.

Void cancelled orders#

Triggers Conditions Actions
Order Item Status Change List Condition on order:items, All: status Equal To 300 VOID with notes on

Status 300 is cancelled, so this voids the authorization once every item on the order is cancelled.

Notify another system with a webhook#

Triggers Conditions Actions
Order Created length(order:payments) Greater Than 0, Wait Until True every 5 minutes for 60 Webhook (POST) to https://www.example.com/miva/orders with credentials, Add to Queue webhook_sent

Webhooks aren’t retried, so the queue gives the receiving system a list to check against. See Webhooks.

Run a workflow only once per order#

Workflows run on every trigger. To make one run once, have it mark the order and skip marked orders. With a checkbox custom field welcome_sent in the Custom Fields module:

Triggers Conditions Actions
Order Status Change order:CustomField_Values:customfields:welcome_sent Empty Webhook (POST), Set Custom Field customfields / welcome_sent to 1