Skip Navigation

[Resolved] Adding Custom Fields to Products

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: Africa/Casablanca (GMT+01:00)

This topic contains 15 replies, has 2 voices.

Last updated by Jamal 4 years, 7 months ago.

Assisted by: Jamal.

Author
Posts
#1615427

Tell us what you are trying to do?

I would like to create a new Product Type (Events) by extending Simple Product settings - and adding Custom Fields.

I would like to know how this could be done using Toolset. I am thinking to create a Custom Field for Checkbox to assign the Category Event to the Product.

If the Event box is ticked then the Custom Fields related to the Event would show up for the User to Complete - The Custom Fields are would be 1) Event Start Date/Time, 2) Event End Date/Time, 3) Event Location.

Is this possible to do using Toolset?

Is there any documentation that you are following? Setting Up Custom Fields and Custom Taxonomies to Products.

Is there a similar example that we can see? No - just trying to figure out if it is possible to do this before taking action.

What is the link to your site? hidden link

#1615519

Hello and thank you for contacting the Toolset support.

To better help you with your request, I would like you to elaborate more on "Product Type".

Do you mean product type from a WooCommerce perspective? Check this screenshot hidden link
If this is the case, Toolset will not help you do it, it will need custom development.

On the other hand, your idea to use a checkbox and display the fields depending on this checkbox field is totally doable with Toolset. The value of a checked checkbox is 1. Check this screenshot from my example hidden link

I hope this helps. Let me know your feedback.

#1615533

Thanks for your reply. To clarify: I do not want to change the Woocommerce product types. I want to add Custom Fields that would appear if a check box Event is checked so I think that Toolset can help me do this.

So the Steps are these:
- Set Data Dependent Display filter - the idea is that if the checkbox for Event is ticked then the related Fields (Start/End Date/Time, Location) would appear. I know how to create Custom Field Groups but dont know how to do the Data Dependent Display Filter - Is there a guide? And would Toolset accept fields such as Location?

Thank you

#1615561

You can create a fields group "Product Event Data" and assign it to Products.

Inside the field group, create the "Event" checkbox field and the three other fields.

For each of the three other fields, set the condition to display the field only when the "Event" custom field equals 1. Check this screenshot hidden link

Even though, you can do this on the "Data Independent Display Filter", I would suggest to not do it as you will be using this for products and only for selected products, those that have the Event checkbox checked.

The result is that the fields group will be displayed for all products, but will only display the "Event" checkbox. If it is checked, it will display the other fields.
https://toolset.com/documentation/user-guides/custom-content/types-custom-fields-conditional-display/

#1618055
event_checkbox.jpg
event_checkbox2.jpg

I want to clarify on your instructions. I set the Checkbox called Event Info - see screenshot. However I am not able to assign Conditional Display to other Fields because the Checkbox Event Info is not in the dropdown list of options. So I am not able to add these fields to Products if it is an Event.

#1618103

I can see two possible causes.
- Maybe the field is not saved yet.
- Maybe you need to refresh the page.

Can you tell me from which page did you take the screenshot "event_checkbox.jpg"?

#1618221
event_checkbox3.jpg

I created Custom Fields called Event Info - see attached. I clicked on any one of the Fields (see attached) and set the Conditional Display but Event check box is not an option.

His the Group: hidden link

#1618249

You are using a "Checkboxes" (plural) field instead of a "Checkbox" field. Check this screenshot. I implemented a "Is Event" checkbox field and it appears in the conditions hidden link

#1618255
event_checkbox4.jpg
event_checkbox5.jpg
event_checkbox6.jpg
event_checkbox7.jpg

I understand what I did wrong. I have now set the Conditional Display for that Field Group - see attached.
The problem is that the Custom Field Group does not seem to be appearing in the back end when a new Product is uploaded. So it is not being used - see attached.

#1621145

As the field group depends on the product_type(term ticket-event), the product needs to be, first, saved and assigned the term ticket-event before the condition is met. Once you save the product, the fields group will appear. Check this screenshot for an event product hidden link

#1621175

So in terms of the Work flow, the user needs to set the Product Type to Event and save it before being able to add the Custom Fields related to the Product Type Event?

Ideally, when the User selects Product Type event, then the Custom Fields should show up automatically and Not have to go to the extra step of saving the Product..before being able to add those fields

#1621187

So in terms of the Work flow, the user needs to set the Product Type to Event and save it before being able to add the Custom Fields related to the Product Type Event?
Yes. Toolset needs to have the product saved to check what product_type is assigned to it.

Ideally, when the User selects Product Type event, then the Custom Fields should show up automatically and Not have to go to the extra step of saving the Product..before being able to add those fields
This can't be done, because the term assignment is saved in a different table, it needs the post to be saved(to have an id). That's why it needs to have the product saved. Does it make sense?
Check this article hidden link

#1621239
event_tickets2.jpg
event_tickets.jpg

Right now I have a plugin called Yith Event Tickets which essentially extends the default Woo Single Product to add Custom Fields related to events such as Date, Location etc. See attached screenshot of selecting Event Tickets and the other screenshot show all the custom Fields related to Event Ticket.

When I select Event Ticket, all the Custom Fields appear automatically and there is no need to save the product.

I was hoping to replace Yith Event Tickets with Toolset Custom fields. From what you are saying - with Toolset, the Custom Fields do not appear automatically and it is necessary to save the Product First before being able to add these fields. So there is an extra step.

Why is it that the other plugin can make custom fields automatically.. but Toolset has to add another layer of action

#1621315

I would say that because of both plugins(Toolset and Yith Event Tickets) are different products for different markets. Each one tries to resolve problems for different kinds of users.

Yith Event Tickets is trying to resolve a problem for WooCommerce users. In fact, it uses WooCommerce views. The plugin custom fields are displayed/hidden in the WooCommerce meta box.
https://developer.wordpress.org/plugins/metadata/custom-meta-boxes/

Toolset plugins allow novice, as well as WordPress experts, to build custom sites in hours instead of weeks. A novice user won't be able to build a similar meta box to WooCommerce with Toolset. But an expert or developer can use Toolset with some additional custom code to build a similar experience to the WooCommerce meta box.

#1621665
Event_fields2.jpg
Event_fields.jpg

Thank you for the explanation. So a Toolset contractor could create a User experience similar to the other plugin? where the custom fields appear automatically if a checkbox or other similar field is selected.

Another feature of the other plugin is the ability to create field groups linked to Woocommerce Add to Cart - for example, Users can submit information through form when they purchase the product so it is linked to the Add to Cart- see screenshots.

Is it possible to do this using Toolset?

New threads created by Jamal and linked to this one are listed below:

https://toolset.com/forums/topic/can-toolset-customize-the-add-to-cart-to-add-multiple-fields/