Your cart is currently empty!
Combining Product co-owner commission with regular affiliates.
—
by
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
Comments
6 responses to “Combining Product co-owner commission with regular affiliates.”
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!
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
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? 🙂
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
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!
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