How to Get a Specific User Subscription with WooCommerce?

Check if user has an active subscription on WooCommerce. This will allow you to retrieve all user subscriptions or use the function.

I was trying to find the function to grab the active user subscriptions for WooCommerce and found a function that gives you information about the user.

wcs_get_users_subscriptions($user_id)

This is the function I used on my functions.php

function has_active_subscription( $user_id='' ) {
    // When a $user_id is not specified, get the current user Id
    if( '' == $user_id && is_user_logged_in() )
        $user_id = get_current_user_id();
    // User not logged in we return false
    if( $user_id == 0 )
        return false;

    return wcs_user_has_subscription( $user_id, '', 'active' );
}