By default, the new user’s role is updated when the order status is changed to ‘Processing’. You can change this to update the new user’s role when the order status changes to ‘Complete’ using this snippet:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
|* Assign roles when status is set to completed|
|add_action( 'woocommerce_order_status_completed', 'wcmo_assign_roles_after_purchase', 10 );|
Follow these steps to add the snippet to your site.