2017-01-04 8 views
-1

製品にリンクされているすべてのメンバーシッププランの配列が必要です。私は、すべてのプラン、またはユーザーが現在持っているプラ​​ンをリストしたり、特定のプランに対してユーザーをチェックする機能しか見つけられませんが、ユーザーが特定の製品のコンテンツに動的にアクセスできるかどうかを確認する方法はありません。WooCommerceのメンバーシップ - リストの製品制限

The below screenshot shows the information I'm trying to retrieve.

答えて

0

は下記うまく動作するように見えました。

if (wc_memberships_is_product_purchasing_restricted()) { 
 

 
    $has_access = current_user_can('wc_memberships_purchase_restricted_product', $productID); 
 

 
    if ($has_access) { 
 
    return true; 
 
    } else { 
 
    return false; 
 
    } 
 

 
}

関連する問題