Skip Navigation

[Resolved] WooCommerce products, input fields in frontend

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

Assisted by: Luo Yang.

Author
Posts
#1579391

Is it possible to add some custom fields to products which buyers fill? So this would be kind of toolset form+woocommerce product.
The buyer should be able to give some measures in the purchase process. But is this possible with Toolset custom fields for WooCommerce?

#1579499

Hello,

I don't think it is a good idea to let users to add fields into product posts, it will require user to edit your product posts.

As a workaround, you can use a custom post type to store those custom fields. For example:
1) Create a custom post type "my-cpt", setup custom fields in this post type.
https://toolset.com/documentation/user-guides/custom-content/create-a-custom-post-type/
https://toolset.com/documentation/user-guides/custom-content/using-custom-fields/

2) Setup one-to-many relationship between post type "Product" and "my-cpt"
https://toolset.com/documentation/post-relationships/

3) Follow our document to setup a post form for creating new "my-cpt", and charge users when they submit the form:
https://toolset.com/documentation/user-guides/front-end-forms/using-cred-commerce-to-add-payments-to-forms/

4) Setup some custom PHP codes, after user complete Woocommerce order, use action hook "cred_commerce_after_order_completed" to trigger a PHP function
https://toolset.com/documentation/programmer-reference/cred-commerce-api/#cred_commerce_after_order_completed
in this PHP function, relate the new "my-cpt" post with the "Product" post
https://toolset.com/documentation/customizing-sites-using-php/post-relationships-api/#toolset_connect_posts

5) So in a single "Product" post, you can display related "my-cpt" posts:
https://toolset.com/documentation/post-relationships/how-to-display-related-posts-with-toolset/#displaying-many-related-items