Overview
AffiliRex is a WooCommerce affiliate tracking plugin for WordPress. It attributes registrations and orders to affiliates via referral links or coupon codes, syncs order statuses with a full audit trail, and provides admin reporting with Excel export.
The WordPress admin includes Conversions (individual records), Summary (per-affiliate totals), Affiliates (CRUD + triggers) and Settings.
Requirements
- WordPress 6.0 or later
- PHP 8.1 or later
- WooCommerce (required for order tracking and status sync)
- Composer dependencies installed in the plugin folder (OpenSpout, required for Excel export)
- A valid AffiliRex license for settings, affiliates, and reports
Installation
- Purchase a license and download the plugin from deltadino.com.
- Upload the affilirex folder to wp-content/plugins/ or install via the WordPress admin panel.
- Run composer install inside the plugin directory so Excel export works.
- Activate the plugin. WooCommerce must be active for order features.
- Go to AffiliRex → License and enter your license key.
- Configure settings under AffiliRex → Settings, then create affiliates and add triggers (slugs or coupons).
Tracking & attribution
AffiliRex supports two inbound routing modes, configurable under AffiliRex → Settings:
- Query parameter — e.g. ?ref=partner-slug (parameter name is configurable)
- Pretty URLs — e.g. /affiliate/partner-slug (base path is configurable); visitors are redirected to the site home after the cookie is set
- A 30-day HttpOnly cookie stores the matched affiliate and trigger
- At checkout, WooCommerce coupon triggers take priority over link/cookie attribution
- Registration conversions are captured via the user_register hook when a tracking cookie is present
- Order conversions sync amount, currency, and status when WooCommerce order status changes
Affiliates
- Create affiliates with a title, optional linked WordPress user, active/inactive status, and optional start/end dates
- Add triggers per affiliate: slug (referral link) or coupon (WooCommerce coupon code, case-insensitive match)
- List view: filter by active/inactive status, search by title/slug/coupon/user, export filtered results to Excel
- Each row links to Conversions filtered by that affiliate
- Copy buttons are available for slug and coupon values in the list
Conversions
- Lists every conversion record: ID, date, affiliate, type (order/registration), source (order or user link), trigger (link/coupon badge), amount, and status
- Expand a row to view the full status change timeline
- Filters: date range, conversion type, status, affiliate (AJAX search), and free-text search on trigger/source ID
- Export to Excel with progress UI; includes a Status History sheet with all status transitions
- Export columns: ID, Date, Affiliate ID, Affiliate, Type, Source ID, Trigger Type, Trigger Used, Amount, Currency, Status
Affiliate Summary
AffiliRex → Summary shows per-affiliate conversion totals. Date filters apply to conversion record dates, not affiliate creation dates.
- Columns: ID, Affiliate, Registrations, Orders, and grouped Completed / Pending / Cancelled orders
- Each status group shows Total (sum of order amounts), Count, via link, and via coupon
- Order amounts are summed per currency — mixed-currency affiliates show separate totals (e.g. $100.00 and €50.00), not a converted single total
- Filters: date range, affiliate search, affiliate active/inactive status, and title search
- Export to Excel with the same filters applied
Shortcodes
Display the visitor's active referral code on any page or post:
[affilirex_tracking_code]
[affilirex_tracking_code fallback="—"]
[affilirex_tracking_code field="affiliate_id"]Settings reference
- Status mapper — map WooCommerce order statuses to pending, completed, or cancelled buckets; new WC statuses are auto-assigned to Pending
- Reset to WooCommerce defaults — restore the built-in status mapping
- Routing — enable pretty links, set base path and query parameter name
- Commission basis — order total or subtotal (before tax and shipping); amount and currency are stored per conversion record
Multilingual sites
AffiliRex integrates with WPML and Polylang. Query-parameter tracking works on all language variants without extra setup. Pretty-link mode registers per-language rewrite rules when a multilingual plugin is active. The pretty link base can be translated per language.
Developer hooks
AffiliRex exposes 33 filters and 10 actions for deep customization. Filters run after a cache miss and before values are stored, so overrides are cached unless you opt out viaaffilirex_skip_cache. Use these hooks in a custom plugin or mu-plugin — never edit AffiliRex core files directly.
add_filter( 'affilirex_commission_amount', function( $amount, $order, $basis ) {
return $amount * 0.10; // 10% commission
}, 10, 3 );Filters (33)
Registered via apply_filters() in WordPress.
| Hook | Arguments | Description |
|---|---|---|
affilirex_skip_cache | $skip, $key | Opt out of caching for a specific cache key. |
affilirex_cache_ttl | $ttl, $key | Override the TTL for a specific cache key. |
affilirex_trigger_lookup | $trigger, $type, $value | Modify a trigger row after database lookup, before caching. |
affilirex_affiliate | $affiliate, $id | Modify an affiliate record after fetch. |
affilirex_is_affiliate_valid | $valid, $affiliate | Override active/date-range validation for an affiliate. |
affilirex_should_set_tracker | $should, $affiliate, $trigger | Allow or block writing the tracking cookie on an inbound hit. |
affilirex_tracker_cookie | $payload, $affiliate, $trigger | Modify the JSON payload stored in the tracking cookie. |
affilirex_tracker_ttl | $seconds | Change cookie lifetime (default 30 days). |
affilirex_pretty_url_redirect | $redirect, $slug | Change where pretty-link visits redirect after the cookie is set. |
affilirex_slug_url | $url, $slug | Modify the generated pretty referral URL for a slug trigger. |
affilirex_shortcode_tracking_code | $value, $atts, $tracker | Filter output of the [affilirex_tracking_code] shortcode before escaping. |
affilirex_should_track_conversion | $should, $context | Allow or block a conversion record insert. |
affilirex_commission_amount | $amount, $order, $basis | Adjust the commission amount after subtotal/total calculation. |
affilirex_record_data | $data, $context | Modify the full record row payload before database insert. |
affilirex_status_history_entry | $entry, $record_id | Modify a status history row before insert. |
affilirex_default_status_mapping | $mapping | Customize WooCommerce-aware default status buckets on install. |
affilirex_mapped_status | $status, $wc_status | Override how a WooCommerce order status maps to pending/completed/cancelled. |
affilirex_export_columns | $columns, $sheet | Customize Excel export column headers for the Conversions sheet (or history sheet). |
affilirex_export_row | $row, $record | Modify a single conversion export row before it is written. |
affilirex_export_process_inline | $process_inline, $job_id, $total | Run conversion exports inline in the admin request instead of a background job (default true). |
affilirex_export_batch_size | $size | Change rows per conversion export batch (default 1000). |
affilirex_export_max_rows | $max | Set maximum rows per conversion export job (default 100000). |
affilirex_export_include_history | $include | Include or exclude the Status History sheet in conversion exports. |
affilirex_export_time_budget | $seconds | PHP time limit per conversion export batch (default 300s). |
affilirex_affiliate_export_columns | $columns | Customize column headers for the Affiliates Excel export. |
affilirex_affiliate_export_row | $row, $affiliate | Modify a single affiliate export row before it is written. |
affilirex_affiliate_export_max_rows | $max | Set maximum rows for the Affiliates Excel export (default 100000). |
affilirex_summary_export_columns | $columns | Customize column headers for the Affiliate Summary Excel export. |
affilirex_summary_export_row | $row, $summary | Modify a single affiliate summary export row before it is written. |
affilirex_summary_export_max_rows | $max | Set maximum rows for the Affiliate Summary Excel export (default 100000). |
affilirex_current_language | $lang | Override the detected language slug for multilingual routing. |
affilirex_pretty_base | $base, $language | Set per-language pretty-link prefix (WPML/Polylang). |
affilirex_active_language_slugs | $slugs | Override the list of language slugs used for rewrite rules. |
Actions (10)
Registered via do_action() at lifecycle events.
| Hook | Arguments | Description |
|---|---|---|
affilirex_rewrite_rules_registered | — | Fires after AffiliRex registers pretty-link rewrite rules. |
affilirex_tracker_set | $affiliate_id, $trigger, $payload | Fires after the tracking cookie is written on an inbound hit. |
affilirex_before_insert_record | $data | Fires immediately before a conversion record is inserted. |
affilirex_after_insert_record | $record_id, $data | Fires after a conversion record is successfully inserted. |
affilirex_record_amount_updated | $record_id, $amount, $currency | Fires when an order conversion amount or currency is synced from WooCommerce. |
affilirex_status_changed | $record_id, $old, $new, $changed_by | Fires after a record status is updated via order sync. |
affilirex_export_started | $job_id, $filters | Fires when a conversion Excel export job is created. |
affilirex_export_completed | $job_id, $file_path | Fires when a conversion export file is finalized and ready for download. |
affilirex_export_failed | $job_id, $error | Fires when a conversion export job fails. |
affilirex_cache_invalidated | $keys | Fires after one or more cache keys are busted. |
Need help?
Email support@deltadino.com for setup questions, license issues, or hook guidance. Active license holders receive priority support.