Accessing A Customer’s Credit Balance
May 7, 2019 9:30 pmHello! I’m about to add a credits system to my online shop, but I want to be sure that customers have credits before I allow them to access certain features. Is there a way I can access the current user’s credit balance from either the WordPress backend or from the Front End with Javascript?
Thanks!
8 Comments
8 Replies
Yes! Please watch https://woocredits.com/video-tutorials/editing-user-credit-balance/ for quick tutorial on searching / editing user’s credit balances in WP Admin. Thanks and have a nice day!
Thanks for the response, but I’m looking to access the value of a user’s credits with code. Preferably within my functions.php file in WordPress. Is that possible?
So that the user can see their individual balance?
So that I would be able to prompt them to spend credits on the services my website would be offering, mainly.
Thank you for clarifying. We have added to development board and will include with next update. Please keep eye on release notes. Thanks!
Please check 3.5.3 where we have added function:
wdcp_get_user_credits($user_id)
which will return logged in user’s credit balance.
Thank you so much! This was an awesome customer service experience!
Great! Glad it worked for you. Obviously, not required, but if you ever want to leave feedback on WordPress.org that is always appreciated 🙂 https://wordpress.org/support/plugin/woo-download-credits/reviews/