mirror of
https://gh.wpcy.net/https://github.com/mainwp/Code-Snippets-Functions.git
synced 2026-04-30 11:42:22 +08:00
19 lines
651 B
Text
19 lines
651 B
Text
function affwp_check_for_zero_amount_referral_disable_email( $return, $referral ) {
|
|
|
|
// Check to see if AffiliateWP is active.
|
|
if ( ! function_exists( 'affiliate_wp' ) ) {
|
|
return;
|
|
}
|
|
|
|
// Get the referral amount from the referral object passed in.
|
|
$referral_amount = $referral->amount;
|
|
|
|
// Check of the referral amount is zero, will be formatted to a string.
|
|
if ( $referral_amount == '0.00' ) {
|
|
// Disables the "New Referral Email" sent to the affiliate if the amount of the referral is zero.
|
|
$return = false;
|
|
}
|
|
|
|
return $return;
|
|
}
|
|
add_filter( 'affwp_notify_on_new_referral', 'affwp_check_for_zero_amount_referral_disable_email', 10, 2 );
|