Order Processor Integration #
New in v1.2.0
When a WooCommerce order is completed, DDLS Core creates license, subscription, and support contract records automatically. Three filters allow extensions to modify the data for each record type before it is inserted into the database.
The Three Filters #
| Filter | Fires Before |
|---|---|
dmsilm_license_data_before_create | License record is created |
dmsilm_subscription_data_before_create | Subscription record is created |
dmsilm_support_contract_data_before_create | Support contract record is created |
The three filters have different signatures depending on the record type being created:
| Filter | Parameters |
|---|---|
dmsilm_license_data_before_create | $data, $order, $settings |
dmsilm_subscription_data_before_create | $data, $order, $license, $settings |
dmsilm_support_contract_data_before_create | $data, $order, $license, $settings |
License filter parameters:
| Parameter | Type | Description |
|---|---|---|
$data | array | Associative array of fields that will be inserted into the database |
$order | WC_Order | The WooCommerce order object |
$settings | array | Resolved effective license settings for this product/variation |
Subscription and support contract filter parameters:
| Parameter | Type | Description | |
|---|---|---|---|
$data | array | Associative array of fields that will be inserted into the database | |
$order | WC_Order | The WooCommerce order object | |
$license | array | null | The license record just created for this order item (may be null in some support contract scenarios) |
$settings | array | Resolved effective settings for this product/variation |
Return the (modified or unmodified) $data array from your callback.
License Data Filter Example #
add_filter( 'dmsilm_license_data_before_create', function( $data, $order, $settings ) {
// Example: set license type based on a coupon code
$coupons = $order->get_coupon_codes();
if ( in_array( 'ENTERPRISE2026', $coupons, true ) ) {
$data['license_type_id'] = 5; // Enterprise license type ID
}
return $data;
}, 10, 3 );
Subscription Data Filter Example #
add_filter( 'dmsilm_subscription_data_before_create', function( $data, $order, $license, $settings ) {
// Example: extend trial period for orders from a specific country
$billing_country = $order->get_billing_country();
if ( 'AU' === $billing_country ) {
$data['trial_days'] = 30;
}
return $data;
}, 10, 4 );
Support Contract Data Filter Example #
add_filter( 'dmsilm_support_contract_data_before_create', function( $data, $order, $license, $settings ) {
// Example: sync to external support desk on creation
My_Ext_Support_Sync::queue( $data, $order->get_id() );
return $data; // return unchanged
}, 10, 4 );
Use Cases #
- Change license type: Assign a different license type based on coupon, billing country, or product meta.
- Set custom fields: Populate extension-specific database columns added via schema extension.
- Sync to external systems: Queue the record data for delivery to a CRM, support desk, or webhook endpoint.
- Adjust limits: Override default activation limits or expiry dates based on order-level context.
Important Notes #
- Always return the
$dataarray, even if you make no changes. - Do not perform slow synchronous HTTP requests inside these filters; queue them instead.
- These filters fire within the WooCommerce order completion hook, so exceptions will interrupt the order process. Wrap risky code in try/catch blocks.
Related Topics #
- [License Types](#)
- [Extension Architecture Overview](#)
