title: Woocommerce: changing user role when order is complete
body: <p>I'm using wordpress with woocommerce, and I would like to automate the following step. When an order is completed, I would like to change the user role associated  with that order id from 'customer' to 'subscriber'.</p>
  
  <p><br></p>
  
  <p>By searching around, I think I should be able to accomplish this by using a hook in functions.php:</p>
  
  <pre><code>add_action( 'woocommerce_order_status_completed', 'change_role_from_customer_to_subscriber' );
  </code></pre>
  
  <p>Then add the function:</p>
  
  <pre><code>function change_role_from_customer_to_subscriber($order_id){
  // code to change role to subscriber
  }
  </code></pre>
  
  <p><br></p>
  
  <p>In the code, I think I need to do 2 things:<br>
  1) get the user id that is associated with that order id<br>
  2) change role of that user id to subscriber</p>
  
  <p><br></p>
  
  <p>I've tried a lot, but I couldn't get it to work (neither getting the right user id, nor changing the role of a user id). So any help would be appreciated! I've seen 2 related questions asked before on stack overflow, but unfortunately the answers there did not work for me. I hope someone can help me out!</p>
  
  <p>Thanks a lot! :)</p>