Skip to content

WooCommerce

The WooCommerce integration creates WPsigner documents automatically when orders reach a specific status. When a customer completes a purchase, you can generate a contract, service agreement, or any document — pre-filled with billing, shipping, and order data — and send it for signing.

[!TIP] This is a “post-purchase” integration. The document is created after the order changes to your configured status (e.g., Completed, Processing).

  • WPsigner v2.0.0 or later
  • WooCommerce v6.0 or later (HPOS compatible)
  • At least one WPsigner template created
  1. Go to WPsigner → Integrations
  2. Find the WooCommerce card and click Configure
  3. Click New Feed to create your first automation

Each feed connects an order status to a WPsigner template:

FieldDescription
Feed NameLabel for your reference (e.g., “Service Agreement”)
Trigger StatusOrder status that creates the document (Processing, Completed, On Hold, etc.)
Product FilterRestrict to specific products. Leave empty for all products.
TemplateWhich WPsigner template to use
Document TitleSupports variables: {{signer_name}}, {{order_id}}, {{billing_name}}, {{date}}
Signer Name/EmailWhich order field provides the signer’s identity
Auto-sendImmediately send the signing email

All fields are extracted using the WC_Order API for full HPOS compatibility.

Field KeyDescription
billing_nameFull name (first + last)
billing_first_nameFirst name
billing_last_nameLast name
billing_emailEmail address
billing_phonePhone number
billing_companyCompany name
billing_address_1Address line 1
billing_address_2Address line 2
billing_cityCity
billing_stateState/Province
billing_postcodeZIP/Postcode
billing_countryCountry code
Field KeyDescription
shipping_nameFull name
shipping_first_nameFirst name
shipping_last_nameLast name
shipping_companyCompany
shipping_address_1Address line 1
shipping_cityCity
shipping_stateState/Province
shipping_postcodeZIP/Postcode
shipping_countryCountry code
Field KeyDescription
order_idOrder ID
order_numberOrder number (may differ from ID)
order_totalTotal amount
order_subtotalSubtotal before tax/shipping
order_taxTax total
order_shipping_totalShipping total
order_discountDiscount total
order_currencyCurrency code (e.g., USD)
order_dateDate created
customer_noteCustomer’s order note
payment_methodPayment method slug
payment_method_titlePayment method label
product_namesComma-separated product names
product_skusComma-separated SKUs

Use the meta_ prefix to access custom order meta fields:

meta_your_custom_field

Map order fields to template variables using the Variable Mapping section in the feed editor:

Variable (Template)Order FieldResult
custom.companybilling_companyCompany name from billing
custom.phonebilling_phonePhone number
custom.totalorder_totalOrder total amount
custom.productsproduct_namesList of purchased products

In your template, reference these with {{custom.company}}, {{custom.phone}}, etc.

By default, a feed triggers for all products. To restrict it:

  1. In the feed editor, select specific products from the Product Filter dropdown
  2. Hold Ctrl (Windows) or Cmd (Mac) to select multiple
  3. The feed only triggers if the order contains at least one matching product

[!NOTE] Variation products are also checked — if a parent product matches, the feed triggers.

MeasureImplementation
Nonce verificationAll 5 AJAX endpoints verify wps_ajax_nonce
Capability checkAdmin operations require manage_options
Rate limitingMax 10 documents/minute per order (transient-based)
Duplicate preventionOrder meta tracks which feeds have been processed
Status validationTrigger status validated against WC registered statuses
Field whitelistSigner fields validated against allowed order fields
Email validationsanitize_email() + is_email() double check
Error loggingSensitive data redacted, only logs with WP_DEBUG

Fires after a document is created from a WooCommerce order.

add_action('wps_woocommerce_document_created', function($document_id, $order, $feed, $feed_id) {
// $document_id - int - The created document ID
// $order - WC_Order - The WooCommerce order object
// $feed - array - Feed configuration used
// $feed_id - string - Feed identifier
// Example: add custom order note
$order->add_order_note(
sprintf('WPsigner document #%d created.', $document_id)
);
}, 10, 4);
  1. Verify the feed is enabled
  2. Check the trigger status matches the order’s new status
  3. If product filter is set, ensure the order contains a matching product
  4. Check WP debug log for [WPsigner WooCommerce] entries

Each feed stores a _wps_wc_processed_{feed_id} meta on the order. If an order is reprocessed (e.g., status changed back and forth), it won’t create duplicates for the same feed.

The integration requires class_exists('WooCommerce') to be true. Ensure WooCommerce is active and not deactivated by another plugin.

This integration uses WC_Order getters exclusively ($order->get_billing_email(), etc.) and $order->update_meta_data() + $order->save() for meta storage. It is fully compatible with WooCommerce HPOS (High-Performance Order Storage).