Can’t seem to find the answer or where to look for this question but maybe someone who has been down this route will know.
On a successfully WooCommerce order I just want to add some extra code to set the role of the User who made the order to “paid member”.
So it will just update row of dbname_capabilities (in dbname_usermeta) where the user_id = the user_id and set it to a:1:{s:10:”paidmember”;b:1;}.
The idea of this is then that member will then have access to certain pages on the site after he has paid automatically.
Thanks for any help. 🙂
You will need to hook into
woocommerce_thankyou
function. Here you can use the default wordpress functionwp_update_user
:http://codex.wordpress.org/Function_Reference/wp_update_userI hope this gets you on the right track.