Home › Toolset Professional Support › [Resolved] Want to make it so that fields on Custom Post only appear for certain categorie
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 |
---|---|---|---|---|---|---|
- | 10:00 – 13:00 | 10:00 – 13:00 | 10:00 – 13:00 | 10:00 – 13:00 | 10: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/Kolkata (GMT+05:30)
Tagged: Setting up custom fields, Types plugin
Related documentation:
This topic contains 12 replies, has 3 voices.
Last updated by Minesh 4 years, 8 months ago.
Assisted by: Minesh.
Tell us what you are trying to do?
I have this custom field for Products and have created a repeatable field group (Products Extra). This product field group is only supposed to appear for certain product Types (for example Event Tickets and not Simple Product). Right now it is on the template of all the products. How do I edit so that this field group only appears for specific products?
Is there any documentation that you are following? Repeatable fields
Is there a similar example that we can see? See attached
What is the link to your site? hidden link
Hello,
Please try these:
Dashboard-> Toolset-> Custom Fields, find and edit the field group "Products Extra", click and open pannel "Settings for test group 4":
1) click button "Edit", click tab "Taxonomies", enable the specific term of taxonomy "Product Categories"
2) enable option "when ALL conditions are met".
See screenshot field-group-setting.JPG
When you create/edit a product post, you can enable the specific term, save the post, and refresh browser, you will be able to see the custom field group "Products Extra"
Hello - I do not understand your explanation because I cannot find "Settings for test group 4"
The options I see are different from your screenshot - see attached.
Am I missing something?
Luo is on vacation. This is Minesh here and I'll take care of this ticket. Hope this is OK.
So, As I understand, you want to display the repeating field group "Event Options" filed should be displayed on your post edit page only when the Category is set to term Events?
Yes I only want to collect and display certain field groups that match a certain product category. however I dont really have product categories/taxonomies set up as far as I know..
The solution shared by Luo is correct but I think you are not following him.
Can you please share access details so I can set up a test example for you with one specific taxonomy term.
*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.
I have set the next reply to private which means only you and I have access to it.
First I need to understand what you want to display conditionally.
The screenshot you shared initially, I do not see that field is available now with the product.
=> https://toolset.com/wp-content/uploads/2020/04/1587877-products_extra2.jpg
Also, I am not sure why you assigned the default (tags and categories) as the product as its Products already have it.
As I understand, you have taxonomy Product Categories which have term Events. what field you want to display conditionally?
I deleted that field group that you are referring to. Now I have 2 Field Groups called 'Nearest Tube' and 'Private'
These field groups are only to be applied to Products types that are designated as Events (ticket-events) - see screenshot
My website has Users (Organisers, Vendors) who list these products - the issue is that these Field Groups are appearing on the User Dashboard even when the Product Type is Not and event.
And the 'Nearest Tube' Field Group is not even showing up on the Dashboard - see attached.
Basically I want these Custom Fields to disappear from the User Interface if it is not applicable and only appear when relevant.
I do not see the custom field group 'Nearest Tube' on your install.
So, I made a test with the Private custom field group. With your private custom field group, I have set the option "when ALL conditions are met" as you can see with the following screenshot:
=> hidden link
If you can check with the following test product post:
=> hidden link
If you notice currently the above test product post is setup as "Simple Product" and it will not display the Private custom field group. Now, you should change it to "Event Ticket" from Product Data dropdown and save the settings. As soon as you save it you will see the Private custom field group.
In addition to that, I see with your Private custom field group you have added the field "Private/Invite-only" which is a setup as checkboxes field where you added only one checkbox option. If you want only one checkbox you should add a Checkbox field not checkboxes.
I checked your Test posting - it does not show up, regardless of the product type selected (Event Ticket / Non Event Ticket).
However, for some of the Old Products, the Custom Fields are showing again regardless of product type selected.
hidden link
So Conditional Display is not working..Maybe there is something wrong with the Code? I looked at it again and cant see anything wrong
It seems you misunderstood how it works.
See the test post - The post is set to "Simple Product" - you will not see any custom fields.
=> hidden link
Now, set the post to use "Event Ticket", click on Update button and you will see the Custom fields on your post.
Do you see it works as I mentioned above?
I see what you mean. I thought the Custom Fields would change automatically when the product type is selected - I did not know about having to Update it to see it.
There is an issue in that when uploading a new product, a user would select the Product Type and would not see the Custom Fields until clicking the Publish Button which defeats the purpose of having the fields in the first place..
If the Custom Fields have to rely on the User clicking the Update button to appear, then it is not usable because the point is for the Users to click it while it's been updated..Is there a workaround?
I am thinking about adding Private to the Categories or Tags instead..
I see what you mean. I thought the Custom Fields would change automatically when the product type is selected - I did not know about having to Update it to see it.
==>
OK
There is an issue in that when uploading a new product, a user would select the Product Type and would not see the Custom Fields until clicking the Publish Button which defeats the purpose of having the fields in the first place.
==>
There is no such feature available.
You need to understand how post field conditional display works. Please read the following doc:
=> https://toolset.com/documentation/user-guides/custom-content/types-custom-fields-conditional-display/
You can add the conditions to the custom fields created using Types, please check the screenshot:
=> https://toolset.com/wp-content/uploads/2015/05/custom-fields-conditional-display.png
Please Keep this in mind:
Please note that there are few types of post fields you cannot use as conditions for showing other fields. These fields include the Embedded Media, File Fields (Audio, Video, Image and File Upload field), Multiple Checkboxes field and a WYSIWYG Text Area field. Additionally, repeating fields also cannot be used as conditions for showing other fields.
Post field conditional display will work on custom fields only (which does not include taxonomy)
if you want to display different custom field group based on category, you need to click on update button as its defied in custom field group. AS you can see with the screenshot: hidden link