I am wondering if there is a way to create a listing package with WooCommerce that would allow sellers to buy a package say for 5 listings and then keep track of them as they are used up? This seems to be the one missing piece.
I saw one question about it posted in the forum some four years age where is seemed to be possible but the links in that posting are broken
Hello,
There isn't such kind of built-in feature within Toolset plugins, it requires custom codes.
Here are my suggestions:
1) Create a custom numeric field "listing-package-limit" in Woocommerce order post type
2) After user purchase the Woocommerce product and complete Woocommerce order, use action hook "woocommerce_order_status_completed" to trigger a PHP function
hidden link
in this PHP update the field "listing-package-limit" value to 5
https://developer.wordpress.org/reference/functions/update_post_meta/
3) Create a page, display a view block: (Toolset Woocommerce blocks is required here)
- Query Woocommerce order posts
- Filter by:
a) _customer_user field value is current logged-in user(_customer_user field is Woocommerce built-in feature)
b) field "listing-package-limit" field value is above 0
https://toolset.com/documentation/user-guides/views/filtering-views-by-custom-fields/
- In views' loop:
if there is any result found, display a post form for creating new "listing" post
If no item found, display a link to your Woocommerce product
4) After user submit above post form, use filter hook "cred_form_validate" to update the "listing-package-limit" field value -1
https://toolset.com/documentation/programmer-reference/cred-api/#cred_form_validate
For your reference.