Skip to content

Instantly share code, notes, and snippets.

@amdrew
Last active August 29, 2015 14:07
Show Gist options
  • Save amdrew/ae2cf4bad5ac31d8e17b to your computer and use it in GitHub Desktop.
Save amdrew/ae2cf4bad5ac31d8e17b to your computer and use it in GitHub Desktop.
AffiliateWP - Per-affiliate, per-product rate
<?php
function affwp_custom_per_product_per_affiliate_referral_amount( $referral_amount, $affiliate_id, $amount, $reference, $product_id ) {
$special_affiliate_id = 145;
$special_product_id = 3133;
$special_referral_amount = $amount * .8; // 80%
if ( $special_affiliate_id == $affiliate_id && $special_product_id == $product_id ) {
$referral_amount = $special_referral_amount;
}
return $referral_amount;
}
add_filter( 'affwp_calc_referral_amount', 'affwp_custom_per_product_per_affiliate_referral_amount', 10, 5 );
@vegaix9
Copy link

vegaix9 commented Dec 30, 2014

Nice snippet, really handy. Will it work with $special_product_id only (sans $special_affiliate_id) and vice versa?

@amdrew
Copy link
Author

amdrew commented Feb 5, 2015

Sorry, there's no reply notifications on gists so I have only just seen your reply. I'm not too sure I understand your question, can you contact me through [email protected]?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment