Skip Navigation

[Resolved] Creating Listing Packages

This support ticket is created 4 years, 5 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 4 years, 5 months ago.

Assisted by: Luo Yang.

Author
Posts
#1965053

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

#1965157

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.