Open mihaijoldis opened 2 years ago
This is the code snippet that @tubiz provided so that a commission is not recorded if the purchase was a referral
function affwp_eddc_restrict_commission( $commissions_calculated, $payment ) {
if ( ! function_exists( 'affiliate_wp' ) ) {
return $commissions_calculated;
}
$referral = affiliate_wp()->referrals->get_by_with_context( 'reference', $payment->ID, 'edd' );
if ( ! empty( $referral ) ) {
return array();
}
return $commissions_calculated;
}
add_filter( 'eddc_commissions_calculated', 'affwp_eddc_restrict_commission', 10, 2 );
That code will most likely no longer work as we use custom tables now for commissions. Needs a rewrite to get the data correctly from the DB.