PHP using Woocommerce wcs_user_has_subscription function with specific user_id
<p>I'm getting crazy on this.</p>

<p>I'm making a wordpress plugin and I need to use wcs_user_has_subscription on every user to get the list of every user having this subscription.</p>

<p>Seem's pretty simple, but I can't make the function work when I give a specific user_id.</p>

<p>Everything work fine when I call the function like this :</p>

<pre><code>$has_sub = wcs_user_has_subscription('', 4743, 'active');
</code></pre>

<p>but when I do something like this :</p>

<pre><code>$subscribers = get_users('role=subscriber');
foreach ( $subscribers as $user ) {
    $has_sub = wcs_user_has_subscription($user-&gt;id, 4743, 'active');
}
</code></pre>

<p>I get this error :</p>

<pre><code>PHP Fatal error:  Call to a member function get_order() on null in /path/to/woocommerce-subscriptions/wcs-functions.php on line 81
</code></pre>

<p>Am I missing something obvious ?</p>