Skip Navigation

[Resolved] Toolset Form Status Change using WooCommerce Subscriptions

This support ticket is created 2 years, 6 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 1 reply, has 2 voices.

Last updated by Luo Yang 2 years, 6 months ago.

Assisted by: Luo Yang.

Author
Posts
#2474889

Hello we are using Toolset to create a directory. We offer a free and paid option. For the Paid Listing we’ve connected it to a WooCommerce Subscription product that is set to renew yearly.

In the event that someones chooses to “Cancel” their subscription or does not “Renew” their Subscription how do we ensure that their listing status (post) is changed from “Published” to “Draft”?

And if they decide to renew their subscription, how do we make it automatically update their listing (post) from “Draft” to “Published” again?

#2475083

Hello,

It needs custom codes, for example, you can use their action hooks:
- woocommerce_subscription_status_cancelled
https://woocommerce.com/document/subscriptions/develop/action-reference/#cancelled_subscription
- woocommerce_subscription_status_expired
https://woocommerce.com/document/subscriptions/develop/action-reference/#subscription_expired
To trigger a custom PHP function, in this PHP function:
- Get this user's "Paid Listing" posts:
https://developer.wordpress.org/reference/classes/wp_query/#author-parameters
- And change those posts' status:
https://developer.wordpress.org/reference/functions/wp_update_post/