wordpresswoocommercewoocommerce-subscriptionswoocommerce-memberships

How to get logged in users membership plan in WooCommerce


Currently I am working on membership site where their are two types of membership

1) Free Membership 2) Premium membership

Based on these membership I want to change content of any pages For this I am using WooCommerce, WooCommerce Subscription and WooCommerce Membership.So Please tell me how I can get the membership plan after user logged to its account.

Thanks Mayank


Solution

  • Woocommerce subscriptions plugin has a class WC_Subscriptions_Manager that has a static function get_users_subscriptions. This function returns array containing user's subscriptions. So please use following code:

    <?php
          WC_Subscriptions_Manager::get_users_subscriptions(get_current_user_id());  
    ?>