Skip to content

Instantly share code, notes, and snippets.

@contemplate
Last active April 26, 2023 12:47
Show Gist options
  • Save contemplate/4fb5528d642a8e63846ebda6534f66b7 to your computer and use it in GitHub Desktop.
Save contemplate/4fb5528d642a8e63846ebda6534f66b7 to your computer and use it in GitHub Desktop.
AffiliateWP: Disable New Referral Email for Affiliates with Store Credit Disabled
/*-- Disable New Referral Email for PAID Affiliates -----------*/
function disable_new_refferal_email( $return, $referral ) {
// Check to see if AffiliateWP is active.
if ( ! function_exists( 'affiliate_wp' ) ) {
return;
}
$affiliate_id = $referral->affiliate_id;
$store_credit_disabled = affwp_get_affiliate_meta( $affiliate_id, 'store_credit_disabled', true );
// If Store Credit Disable cancel email
if( $store_credit_disabled ) {
$return = false;
}
return $return;
}
add_filter( 'affwp_notify_on_new_referral', 'disable_new_refferal_email', 10, 2 );
@numeraz
Copy link

numeraz commented Nov 30, 2021

This was very useful. I am not good with PHP but can you help me create a similar filter to not send new referral email if referral amount is less than 10. I know its a long shot, any help will be awesome.

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