Display and Edit Credit Balances
Fast WooCredit Pro gives you flexibility when it comes to displaying your customers credit balance.
Provided your customer is logged in and has credit then their credit balance will always be displayed on the ‘My Account’ page.
However you can also use the following shortcode to display their credit balance on any page in your site.
[fwc_amount]
This could be in the header or sidebar so they always have a visual reminder of their available credits.
You can quickly view all user’s credits balances from the default WordPress users list. To view members with the most credit simply click on the column header and it will reorder the users.
To update each user’s credit balance you simply edit their profile and look for the entry box titled Fast Credit.
From here you can enter a new value or change the existing one. The new credit amount will be immediately available and will be displayed to the customer on the front end of your WordPress site.
Changing the default word ‘Credit’
If you prefer something unique rather than the word ‘credits’, you can easily change the word throughout the site using currency settings on WooCommerce. To do that,
Step 1
Go to general settings on WooCommerce.
Step 2
Scroll down to the bottom until you see “Credit label”. Change this according to your preference and save settings.
Is there any way to programmatically reset all users credit totals as a bulk action?
The code I’m using currently aims to reset the fwc_amount from the Users page, by adding a custom Bulk Action:
/**
* Custom bulk action to reset all user credits code
**/
add_filter(‘bulk_actions-users’, function($bulk_actions) {
$bulk_actions[‘reset-all-credits’] = __(‘Reset all credits’, ‘txtCredits’);
return $bulk_actions;
});
add_filter(‘handle_bulk_actions-users’, function($redirect_url, $action, $user_ids) {
if ($action == ‘reset-all-credits’) {
foreach ($user_ids as $user_id) {
update_user_meta($user_id,’fwc_amount’, 0);
}
}
return $redirect_url;
}, 10, 3);
Hi Sam
Our developer says you can use this code you have posted and it should work correctly to reset all users credits. If you have trouble you can can contact our support further.
Thanks
Dave
I am using the WP REST-API, can you please tell me the endpoint and parameter I should look for to retrieve and/or set the ‘fwc_amount’ for specific users?
Hi Shayne
We have updated the docs for the API here
https://fastflow.io/tutorials/fast-woocredit-pro/api-details/
Let me know if you have further questions?