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_{referral}See source.
fluent_affiliate/provider_reference_{this}See source.
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_{this}See source.
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_{referral}

Dynamic hook — the suffix is determined at runtime. See source for exact usage.

Source: app/Http/Controllers/ReferralController.php

fluent_affiliate/provider_reference_{this}

Dynamic hook — the suffix is determined at runtime. See source for exact usage.

Source: app/Models/Referral.php

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/FluentCart/Bootstrap.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_{this}

Dynamic hook — the suffix is determined at runtime. See source for exact usage.

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

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);

Released under the GPL-2.0 License.