WordPress – Change user role based on custom user metadata value in WooCommerce
I use a wallet system on my website, how can I change the user's role if his balance has dropped below 0? The meta_value can take a value from -500 to 0. add_action('init', 'changerole'); function changerole() { if(!current_user_can('administrator')) { $user_id…