Progressive Rates

Hi,

Is it possible to set the Rates (a custom function would be ok) so that the more an affiliate earns in a month the higher the percentage is?

Example:
€0-€499 12%
€500-€999 15%
€1000-€1499 18%
>= €1500 20%

If is not possible, would you suggest an alternative method to achieve this kind of progressive rates?

Thank you

Posted in
Tags

Comments

3 responses to “Progressive Rates”

  1. Hey Rocco,

    Actually for this one you need to use a different approach. The different rates you choose to apply, need to be set inside the function.
    First you need to get the current date and then get the totals for the previous month interval with this:

    Affiliates_Shortcodes::get_total( $affiliate_id, $from, $until, $status )
    once for status = ‘accepted’ and once for status = ‘closed’
    which returns an array of totals indexed by currency id. Based on the conditions you choose ie
    if the total in EUR is >= 0 and < 500 set the $variable['c'] = 0.12
    if the total in EUR is >= 500 and < 1000 set the $variable['c'] = 0.15
    if the total in EUR is >= 1000 and < 1500 set the $variable['c'] = 0.18
    if the total in EUR is >= 1500 set the $variable['c'] = 0.20

    Regarding the rate in Affiliates > Rates you should choose type Formula and add the following formula in the value: c*s
    so that on each referral the function will multiply the variable rate (c) by the net sale amount (s).

    Obviously the above requires extensive knowledge of PHP to be implemented but this is the basic idea.

    Kind regards,
    George

  2. Rocco Di Fonso Avatar
    Rocco Di Fonso

    Ok, that’s a good start.
    I am more a front end developer so I need help to set things correctly.

    Should I first create different Rates (12% 15% 18% 20%) ?
    And then in functions.php use

    function my_variables( $variables, $rate, $context ) {
    // how do I calculate the monthly earning and assign the right rate?
    return $variables;
    }
    add_filter( ‘affiliates_formula_computer_variables’, ‘my_variables’, 10, 3 );

    Any help would be really appreciated.
    Thanks

  3. Hi Rocco,

    Thanks for using our affiliates system.

    A progressive rate or in terms of implementation a variable rate can be set by using Formula based rates, a feature integrated in Affiliates plugins.

    In order to use a custom formula, you need to implement it using the affiliates_formula_computer_variables hook which will allow you to modify the rate according to the sum amount of the orders the affiliate referred within the monthly interval.

    Kind regards,
    George

Share