title: Hook in woocommerce on subscription expiration
body: <p>How can I create an Hook in woocommerce (wordpress) to be able to trigger a function when a subscription expires?</p>
  
  <p>Something like this</p>
  
  <pre><code>add_action('woocommerce_subscription_expired', 'my_function', 10, 1);
  
  function my_function($order_id) {
      echo "yeahhhh";
  }
  </code></pre>
  
  <p>UPDATE</p>
  
  <p>I found in the developer <a href="https://docs.woothemes.com/document/subscriptions/develop/action-reference/" rel="nofollow">doc</a> the following</p>
  
  <blockquote>
    <p>Action: 'subscription_expired'</p>
    
    <p>Parameters: $user_id Integer The ID of the user for whom the
    subscription expired. $subscription_key String The key for the
    subscription that just expired on the user’s account.</p>
    
    <p>Description: Triggered when a subscription reaches the end of its
    term, if a length was set on the subscription when it was purchased.
    This event may be triggered by either WooCommerce Subscriptions, which
    schedules a cron-job to expire each subscription, or by the payment
    gateway extension which can call the
    WC_Subscriptions_Manager::expire_subscription() function directly.</p>
  </blockquote>
  
  <p>Where should I place this to have it working</p>
  
  <p>Thanks</p>