Thread Starter
smkh1
(@smkh1)
Hey, i found out that i get this error only if login as “Customer” if i login with the account of “Admin” role it works just fine.
But how can i show the current balance to the logged in user with “customer” role??
there should be an end point like current_balance/me so that we can see the current balance of logged in users via rest api.
Hi @smkh1
Use below code in theme function.php file for alow customers to allow access wallet.
add_filter('woo_wallet_rest_check_permissions', 'woo_wallet_rest_check_permissions_callback');
if(!function_exists('woo_wallet_rest_check_permissions_callback')){
function woo_wallet_rest_check_permissions_callback(){
return current_user_can('read');
}
}
Thread Starter
smkh1
(@smkh1)
Hello Subrata Mal,
Thank you for your reply,
As for temporary solution i’ve changed the api/controller files in which it was mentioned current_user_can(‘manage_woocommerce’) i changed it current_user_can(‘customer’) so for now my customers are able to access the rest api.
but i think it is very in-secured since any customer can access any other customer’s data, i would request if there can be an endpoint with current_balance/me or wallet/me where customer will be allowed to check own data and other endpoints will be restricted.
I would request to add “REST_API” settings on the plugin’s front-end dashboard so anyone can change these settings i believe that other users are also in need of this feature since it is required to implement woo-wallet in android/ios or any other native app.
Thank you so much!, as for now my problem is solved! Thanks again.