• Resolved Frank Umeadi

    (@frankapp)


    Please how do I see the total wallet balance amount for all my users?

    I need to know how much my users have in total on my website.

Viewing 7 replies - 1 through 7 (of 7 total)
  • I am also interested in this feature.

    Plugin Author Subrata Mal

    (@subratamal)

    @fab1987a @frankapp We will try to include this feature in our next update.

    @subratamal thank you!!!

    Thread Starter Frank Umeadi

    (@frankapp)

    I have found a way to do it. For anyone still interested in this feature, you can try the below code.

    global $wpdb;
    $total_balance = $wpdb->get_var(“SELECT DISTINCT SUM(p.meta_value) FROM {$wpdb->prefix}usermeta as p WHERE p.meta_key=’_current_woo_wallet_balance'”);
    echo $total_balance;

    @frank Umeadi please how can i use this code and where to add this code?
    is this like a shortcode?
    please where do i place the code and how can i see the balance of all users

    Thread Starter Frank Umeadi

    (@frankapp)

    Alright, let me be very clear. Follow the below guideline to implement this feature.

    1. Create the Shortcode

    Add the following code to your child’s theme functions.php. It is used to create a shortcode that will display the total wallet balance of all users.

    //Create shortcode to display total balance
    add_shortcode( 'total_balance', 'total_balance_shortcode' );
    function total_balance_shortcode(){
    global $wpdb;
    $total_balance = $wpdb->get_var(“SELECT DISTINCT SUM(p.meta_value) FROM {$wpdb->prefix}usermeta as p WHERE p.meta_key=’_current_woo_wallet_balance'”);
    return $total_balance;
    }

    2. Create a WordPress Page

    Then, create a new WordPress page. You can name it Total Wallet Balance or anything you wish. This page is where you will display the total wallet balance of all users. I believe this feature is only useful to the admin, so you don’t have to allow other users to access it. So don’t create a menu link for it.

    Inside the editing area of the page, enter the shortcode [total_balance]. This shortcode will now display the total wallet balance of all users when you open the page.

    I hope this guide helps everyone that needs it. Good luck!

    Thanks for your support i really appreciate
    Is there anyone that can help me ?
    i need a module as a form where by user can borrow credit from admin and admin will take commission in percentage when user credit wallet amount he borrowed will be deducted and commission taken

    please anyone can help

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Total Wallet Balance of All Users’ is closed to new replies.