Hello,
There isn't such kinds of feature within Toolset plugins, it needs custom codes, here are my suggestions.
1) Create a custom post type "serial numbers", with two fields:
- serial number(single line)
- used (checkbox)
1) You can follow our document to setup a Toolset user form for creating "serial numbers" post, and charge them with Woocommerce plugin:
https://toolset.com/documentation/user-guides/using-cred-commerce-to-add-payments-to-forms/
2) After user submit the above post form, and complete Woocommerce order, you can use action hook "cred_commerce_after_order_completed" to trigger a custom PHP function:
https://toolset.com/documentation/programmer-reference/cred-commerce-api/#cred_commerce_after_order_completed
3) In this custom PHP function do these:
- Get the new post ID, see above document, parameter "cred_post_id"
- Use the new post ID to produce an unique serial number, for example:
hidden link
- save the serial number into "serial number" field:
https://codex.wordpress.org/Function_Reference/update_post_meta
4) After user log into your website, show him a wordpress page, in this page display a post view:
- Query "serial numbers" posts,
- filter by post's author is logged in user
https://toolset.com/documentation/user-guides/filtering-views-query-by-author/
- display the "serial number" and "used" fields value
Then he will be able to share the "serial number" to his friends.
5) Create a user field "serial number" (single line)
6) Create a user form for register new users with above "serial number":
https://toolset.com/documentation/getting-started-with-toolset/publish-content-from-the-front-end/forms-for-registering-users/
7) After guest submit above form, use filter hook "cred_form_validate" to trigger a custom PHP function
https://toolset.com/documentation/programmer-reference/cred-api/#cred_form_validate
in this PHP function, do these:
a) Get the posted "serial number" field value
hidden link
use above value to query in "serial numbers" posts, with two filters:
- "serial number" field = posted "serial number" value
- "used" field = empty
https://developer.wordpress.org/reference/classes/wp_query/#custom-field-post-meta-parameters
b) If there isn't any result found, then return an error message
c) If there is a result found, then update the "used" field value to 1
For your reference.