Auto Credit Referral AffiliateWP

Free plugin Unanswered

Auto Credit Referral AffiliateWP

Started by s.garazh2002 TeraWallet – Best WooCommerce Wallet System 1 year, 9 months ago

Conversation

1 posts · 1 voices
Viewing 1 post (of 1 total)
  • July 21, 2024 at 12:34 pm #5828

    Hello! I want payments to be paid automatically. If I create a payment through the rest API, the payment is created, but the partner’s balance is not replenished. I found this code, but it doesn’t solve this problem either.

    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');
Viewing 1 post (of 1 total)

Post a reply

Paste the exact error, your WooCommerce + WordPress versions, and any relevant steps. Screenshots help.

Sign in to reply

You must be logged in to reply to this topic.

Still stuck?

Three fast ways to keep moving if the thread above didn't resolve it.

WhatsApp