Hooks & Filters Reference
Complete reference of InfusedWoo's public hooks and filters with code examples.
Hooks & Filters Reference
Complete reference of InfusedWoo’s public hooks and filters for developers. All hooks listed below are verified against the codebase.
Actions (do_action)
Order & Payment Processing
// After payment is fully processed and synced to Keap (triggers recipes)
do_action('infusedwoo_payment_complete', $order_id, $contactId);
// After a product's per-product actions run (tag, email, action set)
do_action('infusedwoo_product_purchase', $product, $contactId, $order_id);
// After order processing creates/updates the contact
do_action('infusedwoo_order_process', $contactId, $email);
// Keap gateway: after payment completes via Infusionsoft gateway
do_action('infusedwoo_payment_complete_via_infusionsoft', $order_id, $jobid, $inv_id, $subIds, $contactId, $app);
Import / Export
// After an order is imported from Keap to WooCommerce
do_action('iw_order_imported', $keap_order_id, $wc_order_id);
// After an order is auto-imported (Auto Order Import module)
do_action('iw_order_auto_imported', $keap_order_id, $wc_order_id);
// After a WooCommerce order is exported to Keap
do_action('iw_order_exported', $wc_order_id, $keap_order_id);
User & Contact Events
// After user registration is processed and contact created/updated
do_action('infusedwoo_reg_process', $contactId, $user_email);
// When a user agrees to updated terms & conditions
do_action('infusedwoo_user_agrees_to_tc', $user_id);
// When a user cancels an InfusedWoo subscription from My Account
do_action('infusedwoo_user_cancelled_sub', $subscription_id);
Credit Card Management
// After a new credit card is saved for a user (legacy gateway)
do_action('iw_user_add_newcc', $card_id, $user_id);
// After a user deletes a saved credit card
do_action('iw_userdelete_cc', $card_id, $user_id);
// After a user deletes a saved credit card (REST v2 gateway)
do_action('iw_userdelete_cc_rest', $payment_method_id, $user_id);
Plugin Lifecycle
// When InfusedWoo is activated
do_action('infusedwoo_activate');
// When the automation recipe system is fully loaded (register custom components here)
do_action('infusedwoo_automation_loaded');
// When an Order Macro recipe is manually triggered
do_action('infusedwoo_order_macro_run', $order_id, $recipe_id);
Automation Recipes
// After user identification in a trigger
do_action('iwar_identify_user');
// After an HTTP POST action completes
do_action('iwar_httppost_action', $result, $url, $fields_string);
Filters (apply_filters)
Contact & Registration
// Modify contact data before creating/updating in Keap on registration
$contact_data = apply_filters('iw_reg_contactvals', $contact_data, $user_email);
// Modify contact data before updating an existing contact
$contact_data = apply_filters('iw_before_updatecontact', $contact_data, $contactId);
// Modify contact data before adding a new contact
$contact_data = apply_filters('iw_before_addcontact', $contact_data);
// Override lead affiliate ID assignment
$affiliate_id = apply_filters('iw_set_leadaffiliateid', $affiliate_id);
// Control whether a contact is created at checkout (return false to skip)
$create = apply_filters('infusedwoo_create_contact_on_checkout', true);
API & Integration
// Override REST vs XML-RPC per service ("gateway", "contacts", "orders", etc.)
$use_rest = apply_filters('iw_should_use_rest_api', $use_rest, $service_name);
// Modify the maximum auto-adjustment threshold for payment rounding
$threshold = apply_filters('iw_max_auto_adjustment', 1.00);
// Control whether failed invoices are deleted on payment failure
$delete = apply_filters('iw_delete_failed_invoices', true);
Gateway & Payments
// Override the merchant account ID used for payment processing
$merchant_id = apply_filters('iw_pg_merchant_id', $merchant_id, $order);
// Modify order data before creating in Keap
$order_data = apply_filters('infusedwoo_modify_order', $order_data, $order_id);
Thank You Pages
// Modify thank-you page URL variable keys
$key = apply_filters('iw_ty_variable_key', $key);
GDPR & Compliance
// Customize terms & conditions message text
$message = apply_filters('infusedwoo_tc_msg', $message);
// Customize terms & conditions error message
$error = apply_filters('infusedwoo_tc_error_msg', $error);
// Customize cookie alert message
$message = apply_filters('infusedwoo_cookiealert_msg', $message);
// Customize cookie alert button text
$text = apply_filters('infusedwoo_cookiealert_dismiss', $text);
// Customize GDPR cookie preferences page title
$title = apply_filters('infusedwoo_gdpr_cookie_title', 'My Cookie Preferences');
// Customize updated terms & conditions title
$title = apply_filters('infusedwoo_utc_title', $title);
Automation Recipes
// Override the contact email resolved by a trigger
$email = apply_filters('iwar_get_user_email', $email, $trigger);
// Add custom data accessible as merge fields in recipes
$extras = apply_filters('iwar_user_extras', array(), $trigger);
// Intercept/block an action before execution (return false to skip)
$proceed = apply_filters('iwar_process_action', true, $action, $trigger);
Usage Examples
Skip Contact Creation for Specific Orders
add_filter('infusedwoo_create_contact_on_checkout', function($create) {
// Don't create contacts for free orders
if (WC()->cart && WC()->cart->get_total('edit') == 0) {
return false;
}
return $create;
});
Add Custom Data to Registration Contact
add_filter('iw_reg_contactvals', function($data, $email) {
$data['_CustomSource'] = 'WordPress Registration';
return $data;
}, 10, 2);
Override Merchant Account per Order
add_filter('iw_pg_merchant_id', function($merchant_id, $order) {
// Use a different merchant for international orders
if ($order->get_billing_country() !== 'US') {
return 456; // International merchant ID
}
return $merchant_id;
}, 10, 2);
Block Recipe Actions for Test Orders
add_filter('iwar_process_action', function($proceed, $action, $trigger) {
if (!empty($trigger->pass_vars[0])) {
$order = wc_get_order($trigger->pass_vars[0]);
if ($order && $order->get_meta('_is_test_order')) {
return false; // Skip all recipe actions for test orders
}
}
return $proceed;
}, 10, 3);
Customize Cookie Banner Text
add_filter('infusedwoo_cookiealert_msg', function($msg) {
return 'We use cookies to improve your experience. See our privacy policy for details.';
});
Recipe System Hooks
These hooks are specific to the automation recipe system and provide deeper integration points.
infusedwoo_automation_loaded (Action)
Fires after all built-in triggers, conditions, and actions are loaded. Use this to register your custom classes.
add_action('infusedwoo_automation_loaded', function() {
require_once __DIR__ . '/my-trigger.php';
require_once __DIR__ . '/my-condition.php';
require_once __DIR__ . '/my-action.php';
});
When: During plugin load, before init.
iwar_identify_user (Action)
Fires after InfusedWoo identifies the user for a trigger event. Use to enrich user data.
add_action('iwar_identify_user', function() {
// Runs after email, user ID, and IP are set on the trigger
});
iwar_get_user_email (Filter)
Override the email used to identify the contact.
add_filter('iwar_get_user_email', function($email, $trigger) {
// Example: always use billing email for order triggers
if ($trigger instanceof IW_Purchase_Trigger && !empty($trigger->pass_vars[0])) {
$order = wc_get_order($trigger->pass_vars[0]);
if ($order) return $order->get_billing_email();
}
return $email;
}, 10, 2);
Parameters:
$email(string) — Detected email$trigger(object) — The trigger instance
Return: Modified email string
iwar_process_action (Filter)
Allow or block an action from executing. Runs before each action’s process() method.
add_filter('iwar_process_action', function($allow, $action_obj, $trigger) {
// Example: block all Keap tag actions during maintenance
if ($action_obj instanceof IW_InfApplyTag_Action && get_option('maintenance_mode')) {
return false;
}
return $allow;
}, 10, 3);
Parameters:
$allow(bool) — Whether to allow the action (defaulttrue)$action_obj(object) — The action instance being executed$trigger(object) — The trigger instance
Return: true to allow, false to block
iwar_user_extras (Filter)
Attach custom data to the trigger’s user context.
add_filter('iwar_user_extras', function($extras, $trigger) {
$extras['loyalty_tier'] = get_user_meta(get_current_user_id(), 'loyalty_tier', true);
return $extras;
}, 10, 2);
infusedwoo_merge_value (Filter)
Resolve custom merge field values. This is the primary way to add merge fields without creating a trigger.
add_filter('infusedwoo_merge_value', function($value, $group, $key, $fallback) {
if ($group === 'MyPlugin') {
if ($key === 'version') return '2.1.0';
if ($key === 'license') return get_option('my_license_key', $fallback);
}
return $value;
}, 10, 4);
Parameters:
$value(string) — Current value (default empty string)$group(string) — Merge field group (e.g.,WPUser,MyPlugin)$key(string) — Field key within the group$fallback(string) — Fallback value from{{Group:Key|fallback}}syntax
Return: The resolved value string
Note: This filter fires before built-in handlers. If you return a non-empty value, the built-in handler is skipped.
infusedwoo_merge_modifiers (Filter)
Add custom text modifiers for merge fields.
add_filter('infusedwoo_merge_modifiers', function($modifiers) {
$modifiers['uppercase'] = 'strtoupper';
$modifiers['lowercase'] = 'strtolower';
$modifiers['urlencode'] = 'rawurlencode';
$modifiers['trim'] = 'trim';
return $modifiers;
});
Usage: {{WPUser:first_name|uppercase}} resolves to JOHN
Built-in modifiers: md5, sha1, to_curr (WooCommerce price format)
Recipe System Hooks Summary
| Hook | Type | When | Purpose |
|---|---|---|---|
infusedwoo_automation_loaded | Action | Plugin load | Register custom triggers/conditions/actions |
iwar_identify_user | Action | Each trigger fire | Enrich user data |
iwar_get_user_email | Filter | Each trigger fire | Override contact email |
iwar_process_action | Filter | Before each action | Allow/block action execution |
iwar_user_extras | Filter | Each trigger fire | Attach custom user data |
infusedwoo_merge_value | Filter | Merge field resolution | Resolve custom merge fields |
infusedwoo_merge_modifiers | Filter | Merge field resolution | Add text modifiers |
Tips
- Always check if InfusedWoo classes exist before using
instanceofchecks - The
infusedwoo_merge_valuefilter is the easiest way to add data without creating classes - For the
FilterHookmerge group, just register any WordPress filter — it’s automatically available as{{FilterHook:your_filter_name}} - Actions blocked by
iwar_process_actionare silently skipped (no error logged)