Detecting if the current user has an active subscription

后端 未结 2 1756
夕颜
夕颜 2021-02-05 16:59

I\'m developing a website in WordPress with WooCommerce. I\'m using additionally WC Paid Listings and WooCommerce Subscriptions plugins to handle my work.

The problem is

2条回答
  •  伪装坚强ぢ
    2021-02-05 17:42

    Use wcs_user_has_subscription()

    $has_sub = wcs_user_has_subscription( '', '', 'active' );
    
    if ( $has_sub) {
        // User have active subscription
    }
    

提交回复
热议问题