I have set up a directory. Members pay to have listing on the directory, which is in turn hooked up to WooCommerce subscriptions. Everything works well except whenever a subscription expires the content (directory listing) associated with the user is still active. Maybe I've missed this on the documentation but how can I set the content associated with a user to expire when the subscription ends? An inactive subscriber moves from being a "Member" to being a "Customer".
Hi,
Thank you for contacting us and I'd be happy to assist.
I've done some research online, and the WooCommerce Subscriptions don't seem to include this feature. On subscription expiration, it can change the role of the user, but not the status of his/her content/posts.
To achieve this, you'll need to include some custom code. For example, you can use the WooCommerce Subscriptions' 'woocommerce_subscription_status_updated' hook to detect the changes in the user's subscription status:
https://woocommerce.com/document/subscriptions/develop/action-reference/#section-2
This custom function will need to cycle through all the posts where that user is the author and change their status so they're no longer 'published'.
I hope this helps and for more personalized assistance around custom code, you can also consider hiring a professional from our list of recommended contractors:
https://toolset.com/contractors/
regards,
Waqar
Thanks. I think I can get that to work.