1. Home
  2. Knowledge Base
  3. WooCommerce Members Only
  4. Advanced
  5. Update roles when order status is completed
  1. Home
  2. Knowledge Base
  3. WooCommerce Members Only
  4. Update roles when order status is completed

Update roles when order status is completed

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:

<?php
/**
* 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.

Was this article helpful?

Related Articles