Combining Product co-owner commission with regular affiliates.

Hey there! I’m currently setting up a new website in which I’m using the Affiliate Product plugin.

Currently the Affiliate Product plugin doesn’t take other affiliate commissions into account. In other words, when a product owner is set at 70% commission and an affiliate (to promote) at 50% commission, I would pay out 120% of the sale (which ends up in big losses).

I need to transform the Affiliate Product plugin to take into account the affiliate commission, and only pay an X% of what’s left after the affiliate has been paid.

Example: A product is $100. The affiliate would then get $50 (50%), and the product co-owner $35 (70% of the remaining $50).

Currently this is not something build into this plugin, so I’m opening this topic to ask for some guidance. Where would I need to start to implement something like this?

Thanks in advance,

Wilco

6 Responses to Combining Product co-owner commission with regular affiliates.

  1. wdekreij July 25, 2013 at 8:48 am #

    Thanks – that seems to work!

    Right now the 0.5 is hard-coded. In which variable is that actually stored (in case specific products or affiliates have another commission rate)?

    Thanks again!

    • antonio July 26, 2013 at 9:54 am #

      In your custom version, in line 249 of affiliates-products/lib/comp/class-affiliates-product-woocommerce.php you have:
      $rate = bcmul(0.5, $rate, AFFILIATES_REFERRAL_AMOUNT_DECIMALS);
      first param is the commission.
      cheers

  2. wdekreij July 23, 2013 at 8:50 am #

    Ok – just had a crack on it. Thanks again.

    All the code (inside class-affiliates-product-woocommerce.php) makes total sense. I’m the sort of guy who understands all the code and can make some custom changes.. but creating something from scratch is a level to high for me.

    I know that I would need to check 1) IF the sale is also accounted to an affiliate, 2) THEN take that commission into account into the $commission-calculation.

    The question is.. How do I know whether there’s an affiliate involved (e.g. which variable to check?) and in which variable is the current commission for that product & that affiliate stored? Does anyone know that? 🙂

    • antonio July 23, 2013 at 2:53 pm #

      Hi,
      you can use something like this:

      if (!class_exists("Affiliates_Service"))
      include_once( AFFILIATES_CORE_LIB . '/class-affiliates-service.php' );

      $aff_id = Affiliates_Service::get_referrer_id();
      $current_aff = affiliates_get_affiliate( $aff_id );


      if ($current_aff)
      $rate = bcmul(0.5, $rate, AFFILIATES_REFERRAL_AMOUNT_DECIMALS);

      cheers

  3. wdekreij July 23, 2013 at 8:21 am #

    I’ll have a look inside class-affiliates-product-woocommerce.php.

    Option 2 isn’t an option for me, because if there’s no affiliate involved (e.g. direct traffic) the product co-owner should get 70% in full.

    Thanks Antonio!

  4. antonio July 23, 2013 at 8:06 am #

    Hi,
    right now, you have two options:
    1- Directly editing the plugin. In affiliates-product/lib/comp/class-affiliates-product-woocommerce.php (if you are using woocommerce), in line 242 commission is calculated.
    2- If your affiliates commissions are similars, you can recalculate owner commission:
    AMOUNT * 0,5 (affiliates commission) * 0,7 (owner commission) = AMOUNT * 0,35
    You can setup owner commission to 0,35 (affiliates commission keep equals)

    cheers

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

Share