Home › Forums › Wallet AffiliateWP › Auto credit referral amount to wallet
Tagged: Wallet AffiliateWP auto credit
Viewing 1 post (of 1 total)
- AuthorPosts
Please use below code in theme function.php file to set auto paid referral status.
if (!function_exists('can_receive_woo_wallet_credit')) { function can_receive_woo_wallet_credit($affiliate_id) { $ret = false; // Get global setting. $global_woo_wallet_credit_enabled = affiliate_wp()->settings->get('woo-wallet-all-affiliates'); if ($global_woo_wallet_credit_enabled) { $ret = true; } else { $ret = affwp_get_affiliate_meta($affiliate_id, 'woo_wallet_credit_enabled', true); } return $ret; } } if (!function_exists('AffiliateWP_Woo_Wallet_Autopay')) { function AffiliateWP_Woo_Wallet_Autopay() { if (!current_user_can('manage_payouts')) { return; } $new_get_affiliate = new Affiliate_WP_Referrals_DB; $array_aff = $new_get_affiliate->get_referrals( array( 'number' => -1, 'offset' => 0, 'referrals_id' => 0, 'affiliate_id' => 0, 'reference' => '', 'context' => '', 'status' => '', 'orderby' => 'referral_id', 'order' => 'DESC', 'search' => false )); foreach ($array_aff as $aff) { if (can_receive_woo_wallet_credit($aff->affiliate_id)) { $ref = $aff->referral_id; $ref_status = $aff->status; if ($ref_status == "unpaid") { affwp_set_referral_status($ref, "paid"); } } } } } add_action('init', 'AffiliateWP_Woo_Wallet_Autopay');
- AuthorPosts
Viewing 1 post (of 1 total)
- The topic ‘Auto credit referral amount to wallet’ is closed to new replies.