I have YITH Membership + Subscription plugins together, and shop has virtual downloadable products. When Membership / Subscription is active and user has access to a single product, then on a single product page is widget with available downloads – for free or for credits.
How to check if user has access to a single product? It doesn’t matter if can download or not, just if subscription / membership for a product is active. I couldn’t find any solution. I found only this function bellow, but even if I passed proper user ID and product ID to it, this “subscriptions” array is empty, so it says “no active subscriptions” and it’s not truth. I use this code in functions.php
Subscription or membership can be checked, as they both together can be active or not.
https://erlycoder.com/how-to-check-active-subscription-using-yith-woocommerce-subscription/
I added function „CheckStatus” to functions.php and checked if product_id and user_id have values, but subscriptions array is still empty.