Product Icon

WooCommerce Points and Rewards

Reward your customers for purchases and other actions with points which can be redeemed for discounts.

Show users their balance using a shortcode

Create a shortcode that we can insert in a site to allow users to see their points balance.

Author

Current Status

Open

Last updated: August 11, 2021

3 comments

Log in to comment on this feature request.

  1. winitrideit says:

    // Add shortcode to display the logged-in user’s points
    add_shortcode(‘user_points’, function() {
    if (!is_user_logged_in()) {
    return ‘You need to log in to view your points.’;
    }

    $user_id = get_current_user_id();
    $points = get_user_meta($user_id, ‘wc_points_balance’, true);

    if (!$points) {
    $points = 0;
    }

    return ‘You have ‘ . $points . ‘ points.’;
    });

    adding this to woocommerce-points-and-rewards.php should do the trick i think. no promises people. DO NOT IMPLEMENT YOURSELF LET THE DEVS TEST IT FIRST AND UPDATE IF THEY WISH (FINGERS CROSSED THEY DO)

  2. winitrideit says:

    yes this would defo be a good feature

  3. Brian says:

    Yes! I would love to be able to integrate points balance text anywhere. A widget would be great as well.

Use of your personal data
We and our partners process your personal data (such as browsing data, IP Addresses, cookie information, and other unique identifiers) based on your consent and/or our legitimate interest to optimize our website, marketing activities, and your user experience.