• Resolved christigiano1

    (@christigiano1)


    please I am wondering if there is any way through which the transactions on the teraWallet can be summed up to display the sum total on the dashboard of users. Please can anyone help me with this issue. is there also any way through which a shortcode can be generated for this

Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Author Subrata Mal

    (@subratamal)

    @christigiano1 Thanks for reaching out. Do you want to display the sum of all user’s current balances?

    Thread Starter christigiano1

    (@christigiano1)

    @subratamal Thank you, not the sum of all user balances. I want each user to be able to see their all time amount spent on the store on the dashboard, is that possible?

    Plugin Author Subrata Mal

    (@subratamal)

    So you mean the total debited amount from the user wallet?

    Thread Starter christigiano1

    (@christigiano1)

    @subratamal Exactly, that is what i want, is there a ay i can get that done?

    Plugin Author Subrata Mal

    (@subratamal)

    You will get all debited amounts using the below function.

    $debit_amount = array_sum(wp_list_pluck( get_wallet_transactions( array( 'user_id' => get_current_user_id(), 'where' => array( array( 'key' => 'type', 'value' => 'debit' ) ) ) ), 'amount' ) );

    Thread Starter christigiano1

    (@christigiano1)

    please how can i put this into their dashboard? i am having trouble doing it.

    Plugin Author Subrata Mal

    (@subratamal)

    You can override wc-endpoint-wallet.php template file into the theme folder and write the code.

    Thread Starter christigiano1

    (@christigiano1)

    @subratamal thank you for your kind support but i am finding it hard integrating this code so the total debit amount can display on each user account.

    Plugin Author Subrata Mal

    (@subratamal)

    Please try the attached code in the theme function.php file.

    add_action('woo_wallet_before_my_wallet_content', 'woo_wallet_before_my_wallet_content_callback');
    
    if(!function_exists('woo_wallet_before_my_wallet_content_callback')){
        function woo_wallet_before_my_wallet_content_callback(){
            $debit_amount = array_sum(wp_list_pluck( get_wallet_transactions( array( 'user_id' => get_current_user_id(), 'where' => array( array( 'key' => 'type', 'value' => 'debit' ) ) ) ), 'amount' ) );
            echo sprintf('Total spent %s', wc_price($debit_amount));
        }
    }
    Thread Starter christigiano1

    (@christigiano1)

    i dont know if it is the theme i am using but i have also tried to put this in the function.php file and it still remains without a change, there is no column or feature added that shows total debited amount.

Viewing 10 replies - 1 through 10 (of 10 total)

The topic ‘SUMMING TRACNSACTIONS’ is closed to new replies.