Documentation

Install, configure, and extend AffiliRex on your WooCommerce store.

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 an audit trail, and provides reporting with Excel export from the WordPress admin panel.

This documentation covers installation, configuration, and the developer hooks available for customization.

Requirements

  • WordPress 6.0 or later
  • PHP 7.4 or later
  • WooCommerce (required for order tracking and status sync)
  • A valid AffiliRex license for admin settings, affiliate management, and reports

Installation

  • Purchase a license and download the plugin from shop.deltadino.com.
  • Upload the AffiliRex folder to wp-content/plugins/ or install via the WordPress admin panel.
  • Activate the plugin. WooCommerce must be active for order features.
  • Go to AffiliRex → License in the WordPress admin panel and enter your license key.
  • Configure settings, 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)
  • 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

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
  • Routing — enable pretty links, set base path and query parameter name
  • Commission basis — order total or subtotal (before tax and shipping)

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.

Developer hooks

AffiliRex exposes 28 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 (28)

Registered via apply_filters() in WordPress.

AffiliRex developer filters
HookArgumentsDescription
affilirex_skip_cache$skip, $keyOpt out of caching for a specific cache key.
affilirex_cache_ttl$ttl, $keyOverride the TTL for a specific cache key.
affilirex_trigger_lookup$trigger, $type, $valueModify a trigger row after database lookup, before caching.
affilirex_affiliate$affiliate, $idModify an affiliate record after fetch.
affilirex_is_affiliate_valid$valid, $affiliateOverride active/date-range validation for an affiliate.
affilirex_should_set_tracker$should, $affiliate, $triggerAllow or block writing the tracking cookie on an inbound hit.
affilirex_tracker_cookie$payload, $affiliate, $triggerModify the JSON payload stored in the tracking cookie.
affilirex_tracker_ttl$secondsChange cookie lifetime (default 30 days).
affilirex_shortcode_tracking_code$value, $atts, $trackerFilter output of the [affilirex_tracking_code] shortcode before escaping.
affilirex_should_track_conversion$should, $contextAllow or block a conversion record insert.
affilirex_commission_amount$amount, $order, $basisAdjust the commission amount after subtotal/total calculation.
affilirex_record_data$data, $contextModify the full record row payload before database insert.
affilirex_default_status_mapping$mappingCustomize WooCommerce-aware default status buckets on install.
affilirex_mapped_status$status, $wc_statusOverride how a WooCommerce order status maps to pending/completed/cancelled.
affilirex_status_history_entry$entry, $record_idModify a status history row before insert.
affilirex_records_query_args$argsAdjust admin records list table query arguments.
affilirex_export_columns$columns, $sheetCustomize Excel export column headers (records or history sheet).
affilirex_export_row$row, $recordModify a single export row before it is written.
affilirex_export_batch_size$sizeChange rows per export batch (default 1000).
affilirex_export_max_rows$maxSet maximum rows per export job (default 100000).
affilirex_export_include_history$includeInclude or exclude the Status History sheet in exports.
affilirex_export_time_budget$secondsPer-batch time limit for background export jobs (default 20s).
affilirex_current_language$langOverride the detected language slug for multilingual routing.
affilirex_pretty_base$base, $languageSet per-language pretty-link prefix (WPML/Polylang).
affilirex_active_language_slugs$slugsOverride the list of language slugs used for rewrite rules.
affilirex_translate_string$translated, $string, $contextCentral override for plugin UI string translation.
affilirex_license_is_valid$validOverride the final license validation result.
affilirex_license_purchase_url$urlCustomize the purchase/renew URL shown in the license screen.

Actions (10)

Registered via do_action() at lifecycle events.

AffiliRex developer actions
HookArgumentsDescription
affilirex_tracker_set$affiliate_id, $trigger, $cookieFires after the tracking cookie is written on an inbound hit.
affilirex_before_insert_record$dataFires immediately before a conversion record is inserted.
affilirex_after_insert_record$record_id, $dataFires after a conversion record is successfully inserted.
affilirex_export_started$job_id, $filtersFires when a background Excel export job is created.
affilirex_export_completed$job_id, $file_pathFires when an export file is finalized and ready for download.
affilirex_export_failed$job_id, $errorFires when an export job fails.
affilirex_status_changed$record_id, $old, $new, $changed_byFires after a record status is updated via order sync.
affilirex_cache_invalidated$keysFires after one or more cache keys are busted.
affilirex_license_activated$responseFires after a license is successfully activated.
affilirex_license_validated$valid, $responseFires after a remote license validation check completes.

Need help?

Email support@deltadino.com for setup questions, license issues, or hook guidance. Active license holders receive priority support.