Skip to content

Referrals

Hook Reference

HookDescription
fluent_affiliate/referral_config_field_typesFilters the allowed field types in the referral program configuration form.
fluent_affiliate/referral_formatsFilters the available referral link formats (URL parameter styles).
fluent_affiliate/data_export_limitFilters the maximum number of rows returned in CSV exports.
fluent_affiliate/provider_reference_{provider}_urlFilters the admin URL for a referral's source order/payment.
fluent_affiliate/referral_dataFilters the referral data array before a referral is recorded by an integration.
fluent_affiliate/ignore_zero_amount_referralFilters whether referrals with a zero commission amount should be discarded.
fluent_affiliate/commissionFilters the calculated commission amount before it is saved to a referral.
fluent_affiliate/formatted_order_data_by_{provider}Filters the normalized order payload an integration builds before a referral is recorded.
fluent_affiliate/recurring_commissionFilters the recurring commission data before it is recorded for a subscription renewal.

fluent_affiliate/referral_config_field_types

Filters the allowed field types in the referral program configuration form.

Parameters

ParameterTypeDescription
$fieldTypesarrayAllowed field type keys.

Source: app/Helper/CustomSanitizer.php

php
add_filter('fluent_affiliate/referral_config_field_types', function($fieldTypes) {
    $fieldTypes[] = 'my_custom_type';
    return $fieldTypes;
});

fluent_affiliate/referral_formats

Filters the available referral link formats (URL parameter styles).

Parameters

ParameterTypeDescription
$formatsarrayFormat definitions.

Source: app/Helper/Helper.php

php
add_filter('fluent_affiliate/referral_formats', function($formats) {
    return $formats;
});

fluent_affiliate/data_export_limit

Filters the maximum number of rows returned in CSV exports.

Parameters

ParameterTypeDescription
$limitintRow limit. Default 5000.

Source: app/Http/Controllers/AffiliateController.php

php
add_filter('fluent_affiliate/data_export_limit', function($limit) {
    return 10000;
});

fluent_affiliate/provider_reference_{provider}_url

Filters the admin URL for a referral's source order/payment. The suffix is the provider slug.

Parameters

ParameterTypeDescription
$urlstringURL to the order/payment admin page.
$referralReferralThe Referral model.

Source: app/Http/Controllers/ReferralController.php

php
add_filter('fluent_affiliate/provider_reference_my_plugin_url', function($url, $referral) {
    return admin_url('admin.php?page=my-plugin&order=' . $referral->provider_id);
}, 10, 2);

fluent_affiliate/referral_data

Filters the referral data array before a referral is recorded by an integration.

Parameters

ParameterTypeDescription
$dataarrayReferral data (amount, type, affiliate_id, provider, etc.).
$providerstringThe integration provider key (e.g. woo, edd, fluentcart).

Source: app/Modules/Integrations/BaseConnector.php

php
add_filter('fluent_affiliate/referral_data', function($data, $provider) {
    if ($provider === 'woo') {
        $data['amount'] = $data['amount'] * 1.1;
    }
    return $data;
}, 10, 2);

fluent_affiliate/ignore_zero_amount_referral

Filters whether referrals with a zero commission amount should be discarded. Return false to record them.

Parameters

ParameterTypeDescription
$ignorebooltrue to ignore, false to record. Defaults to true.
$contextarrayReferral creation context data.

Source: app/Modules/Integrations/BaseConnector.php

php
add_filter('fluent_affiliate/ignore_zero_amount_referral', '__return_false');

fluent_affiliate/commission

Filters the calculated commission amount before it is saved to a referral.

Parameters

ParameterTypeDescription
$commissionfloatCalculated commission amount.
$contextarrayContextual data: order, affiliate, rate, rate_type, etc.

Source: app/Modules/Integrations/BaseConnector.php

php
add_filter('fluent_affiliate/commission', function($commission, $context) {
    // Apply a cap of $100 per referral.
    return min($commission, 100.00);
}, 10, 2);

fluent_affiliate/formatted_order_data_by_{provider}

Filters the normalized order payload an integration builds before a referral is recorded. The {provider} segment is the integration key (e.g. fluent_cart). Use it to adjust totals, items, or the commission base (referral_order_total).

Parameters

ParameterTypeDescription
$dataarrayNormalized order data: subtotal, tax, discount, shipping, total, items, referral_order_total.
$orderobjectThe source order object from the integrated plugin.

Source: app/Modules/Integrations/FluentCart/Bootstrap.php

php
add_filter('fluent_affiliate/formatted_order_data_by_fluent_cart', function($data, $order) {
    // Exclude shipping from the commissionable total
    $data['referral_order_total'] -= $data['shipping'];
    return $data;
}, 10, 2);

fluent_affiliate/recurring_commission

Filters the recurring commission data before it is recorded for a subscription renewal.

Requires FluentAffiliate Pro.

Parameters

ParameterTypeDescription
$commissionDataarrayCommission data: amount, rate, rate_type, renewal_count, max_renewal_count.
$contextarrayRenewal context: order, affiliate, referral (original).

Source: ../fluent-affiliate-pro/app/Services/Integrations/FluentCart/RecurringReferral.php

php
add_filter('fluent_affiliate/recurring_commission', function($commissionData, $context) {
    // Reduce recurring commission by 50% after 3 renewals
    if ($commissionData['renewal_count'] > 3) {
        $commissionData['amount'] *= 0.5;
    }
    return $commissionData;
}, 10, 2);

FluentAffiliate developer documentation