Tell us what you are trying to do?
I want users to be able to pre-pay for post submission, then be able to post the number of posts they buy. For instance 1, 5, 10, 25 post packages.
Is there any documentation that you are following?
https://toolset.com/documentation/user-guides/front-end-forms/using-cred-commerce-to-add-payments-to-forms/
Is there a similar example that we can see?
I'm having trouble locating this example. It works like a job board, but to buy the job postings in advance.
What is the link to your site? lien caché
Do you have recommendations on instructions?
Hello,
There isn't such kind of built-in feature within Toolset Forms plugin, as you see in the document you mentioned above, it can charge the user once he create a new post.
In your case, it needs custom codes, for example:
1) Create a new numeric user field "post packages"
2) Setup some Woocommerce products for users to purchase:
- 1 post package
- 5 post packages
- 10 post packages
...
3) After user buy one of above product, for example "5 post packages", and complete the Woocommerce order, use Woocommerce built-in action hook "woocommerce_order_status_completed" to trigger a PHP function:
lien caché
4) in this PHP function update user field "post packages" value + 5
https://developer.wordpress.org/reference/functions/update_user_meta/
5) Create a post view
- query posts
- filter by post's author same as current logged in user:
https://toolset.com/documentation/user-guides/views/filtering-views-query-by-author/
- in section "Loop Editor", you can get total post found count with shortcode [wpv-found-count]
https://toolset.com/documentation/user-guides/views/views-shortcodes/#wpv-found-count
get current user's "post packages" field value with Types shortcode [types usermeta='post-packages' format='FIELD_VALUE' current_user='true'][/types]
https://toolset.com/documentation/customizing-sites-using-php/functions/#numeric
Use shortcode [wpv-conditional] to compare above two shortcodes, if "post packages" field value is higher, then display below creating post form
https://toolset.com/documentation/user-guides/views/views-shortcodes/#wpv-conditional
6) Create a post form for creating new post, after user submit the form and new post created
For your reference.
This is incredibly helpful! I had trouble thinking this through. Woocommerce has a trigger add-on that might work here. I will give this a go and contact a contractor if I can't complete this.
Very grateful for your help!
My issue is resolved now. Thank you!