How to Determine if Subscription is Expired Using PHP/MySQL
-
Hello,
I have a product that basically lets people create a customized widget they can use on their website using an embed code. They must purchase a yearly subscription in order to access the widget creator and also for the embed code of the widget to work properly. I just started using YITH Woocommerce Subscription. I created a new product called “My Widgets” and set it as a subscription type with the period being 12 months. On the “My Widgets page”, I would like to add a PHP/MySQL conditional check to see if the current user has an active subscription to the “My Widgets” product. The “My Widgets” page is NOT the product page, this is a completely different page I have created as a landing page where they can see all the widgets they have created and either create a new one, edit an existing one or delete one. From this page, I would like to display a notice to let them know if their subscription to the “My Widgets” product has expired and if so, give them a link to renew their subscription. My issue right now is that I’m not sure where in the database the subscriptions are stored so I am unable to do the conditional check to determine whether or not their subscription to the “My Widgets” product is active or expired. I am using the free version of this plugin.
EDIT: I manually added a test order for myself but I see it did not automatically add a subscription to the product like I thought it would. I went to the Subscriptions section of my admin portal and no subscriptions were listed. There also doesn’t seem to be a way to manually add a subscription in the back end like you can for products/orders/posts/etc. So another question: how do I manually add a subscription for a user?
- The topic ‘How to Determine if Subscription is Expired Using PHP/MySQL’ is closed to new replies.