Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update adjust-rate-for-referrals.html code #167

Open
mihaijoldis opened this issue Mar 10, 2022 · 1 comment
Open

Update adjust-rate-for-referrals.html code #167

mihaijoldis opened this issue Mar 10, 2022 · 1 comment

Comments

@mihaijoldis
Copy link
Contributor

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.

@mihaijoldis
Copy link
Contributor Author

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 );

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant