to: When a business purchases in Woocommerce, no commission should be given

Dear support team!
Referring to the response from (George June 11, 2020 at 1:06 pm #).
We have now developed a code and entered the formula in the rates.

Unfortunately, only the base level will be calculated. Levels 1, 2 and 3 are not calculated.

When guessing in the Value field, we entered the formula as follows:
Basis: t * c * 0.2
Stufe 1: t * c * 0.1
Stufe 2: t * c * 0.05
Stufe 3: t * c * 0.02

The following code is in the theme function (functions.php):

// Hilfsfunktion für Berechnung der Provision
// Funktion zum überprüfen ob ein string mit einer gewissen Zeichenfolge beginnt
function startsWith_2($haystack, $needle)
$length = strlen($needle);
return (substr($haystack, 0, $length) === $needle);

//Berechnung der Provison für Fair-Partner unterbrechen bei Bestellung von Fair-Partnern
// –Provisionen nur bei Bestellungen von Kunden berechnen. Bei Bestellungen von Fair-Partner wird es auf 0,00 gesetzt.
function my_variables( $variables, $rate, $context ) {
$current_user_id = get_current_user_id();
$u_data = get_userdata( $current_user_id );
$is_fairpartner = false;

if ( ! empty( $u_data->roles ) ) {
// ein wp-user kann mehrere Rollen haben – daher müssen alle Rollen überprüft werden
// ob eine der Rollen das Wort “fairpartner” enthält:
foreach ($u_data->roles as $role) {
if (startsWith_2($role, ‘fairpartner’)) {
$is_fairpartner = true;

// Abbruch der Schleife, da eine “fairpartner” Rolle gefunden wurde
if ($is_fairpartner == true){
$variables[’c’] = 0;
$variables[’c’] = 1;

return $variables;
add_filter( ‘affiliates_formula_computer_variables’, ‘my_variables’, 10, 3 );

// –ENDE Provisionen nur bei Bestellungen von Kunden berechnen.

This error message appears 4 times in a row in the debug log:
…PHP Notice: Undefined variable: IX74179 in /homepages/8…/…/…/wp-content/plugins/affiliates-enterprise/lib/eext/wordpress/class-affiliates-multi-tier.php on line 48

What have we overlooked?

With the request for support so that all levels are calculated.


5 Responses to to: When a business purchases in Woocommerce, no commission should be given

  1. George August 3, 2020 at 2:22 pm #

    Hi Christa,

    Sorry for the delay on this but please have a look at your rates and make the following adjustments.
    Instead of using formula based rates for each tier level, use the following:
    1. For level 1, enable relative and set the commission to Rate with value 0.5
    2. For level 2, enable relative and set the commission to Rate with value 0.25
    3. For level 3, enable relative and set the commission to Rate with value 0.01

    This way each tier level commission will be related to the OR commission -relative- and the commission amount will be a proportion of that commission.

    Please use these values and let me know if it works as it should. FYI, the error logged requires an update to take place so this way you can avoid pending for the update and use the system right away with the expected results.

    Kind regards,

  2. George July 29, 2020 at 4:09 pm #

    Hi Christa,

    Thanks for providing your code for this case, much appreciated. It seems to be correct, but I also get the same error you get but shouldn’t. FYI, at the moment I’m in the process of debugging it and if necessary will deploy an update for the plugin.
    What happens if you change your formulas to: s*c*0.1 etc?

    Kind regards,

    • ProEnergetic July 29, 2020 at 7:19 pm #

      Hi George!
      With the formula s * c * 0.1, the commission is not calculated as desired.
      Same error message:
      Undefined variable: IX74179 in /homepages/…./…/wp-content/plugins/affiliates-enterprise/lib/eext/wordpress/class-affiliates-multi-tier.php on line 48

      And the levels’ commissions are not calculated.


      thank you for your efforts

  3. ProEnergetic July 28, 2020 at 11:24 am #

    Hello Eugene!
    Thank you we are healthy.
    We look forward to your help.
    best regards

  4. Eugen Bleck July 27, 2020 at 11:06 pm #

    Hi Christa,

    I trust you are feeling great today!

    Many thanks for using Affiliates and for being a valued customer. I must apologize for the delay in response.

    I’ve gone ahead to notify George and he would be reaching out ASAP.

    Once again, I am super sorry I could only issue a response just now.

    In the meantime, I wish you an awesome and productive day.

    Warm regards,

Only authorized members can comment on this topic.

Log in

We use cookies to optimize your experience on our site and assume you're OK with that if you stay.
OK, hide this message.

Affiliates · Contact · Jobs · Terms & Conditions · Privacy Policy · Documentation · Downloads · Useful Plugins · My Account