Is there a way to force referrals generated by AffiliateWP through WPForm to "pending"?

72 Views Asked by At

I want the status of referrals generated by WPForm to be "pending", so that I can manually review and accept or reject. For the other integrations of AffiliateWP such as WooCoomerce, I want them to remain "unpaid," which is the default referral status. I tried the "Force Pending Referrals" plugin, but it only forced the referral status of all integrations to be pending. That's not what I want. I tried the code below, but the referral status of WPForm is still "unpaid"

<?php

// Add a filter to modify the referral status
add_filter( 'affiliate_wp_referral_status', 'affiliatewp_wpforms_pending_referral', 10, 2 );
function affiliatewp_wpforms_pending_referral( $status, $referral ) {
    // Check if the referral is associated with the WP Forms integration
    if ( $referral->context === 'wp-forms' ) {
        $status = 'pending'; // Set the referral status to pending
    }

    return $status;
}
0

There are 0 best solutions below