Show/Hide Field Group based on Taxonomy when Taxonomy is not in editor

Support MB Conditional Logic Show/Hide Field Group based on Taxonomy when Taxonomy is not in editor

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #45083
    Keith CrossKeith Cross
    Participant

    I have a CPT with a taxonomy that is intended to be either/or "group" or "solo". To assist with this, I made a custom field for the CPT to choose taxonomy with a radio button. I turned the taxonomy off for the editor so it would not appear (thereby avoiding the situation where the user could choose both terms). However, another field group that is set to appear only when the CPT is attributed with the term "solo" the field group is not showing up. The radio button does, in fact, affect the taxonomy. How can I achieve this?

    https://jam.dev/c/10ed5785-b79d-475b-8891-906e213dd9e9

    Addition: I have found that the show/hide ONLY works when the taxonomy is hierarchical AND appears in the editor. I'm also seeing a field group that will not appear even though it meets the condition. I have no idea why. Hoping this is helpful.

    https://jam.dev/c/ac8c786d-ad62-46f2-ab9c-1dbc09d3da2a

    To avoid ambiguity, I'm asking if anyone can suggest how I can exclude the taxonomy from the editor such that I can force the either/or choice of the necessary terms: either "solo" or "group" AND maintain the conditional appearance of other field groups.

    #45093
    PeterPeter
    Moderator

    Hello Keith,

    You should use the Conditional Logic option in the Settings tab of the field group to set the field group show/hide based on a field value. Screenshot https://monosnap.com/file/Hx63fMcezrUbbOo14iJ5uSOe2SSI19
    where 123 is the term ID.

    #45098
    Keith CrossKeith Cross
    Participant

    Hi Peter,
    I tried that, and didn't see the results I was expecting.

    https://jam.dev/c/1e0e79ba-e20b-4fcb-858c-601bfc8306c5

    I also tried again, using a different select field (non taxonomy related field options), and then a conditional field works.

    https://jam.dev/c/03f4dfa1-36a4-4528-af7f-9908020c33a5

    So it seems as though something about the input related to taxonomy isn't working with conditional fields. The toggle or location rules do work...but then there isn't a condition, per ce. Again, I'm trying to make sure the user doesn't select both terms, only one. The display will be dependent on this choice as well.

    Let me know if I'm missing something or making some other erroneous assumption. Thank you!

    #45111
    PeterPeter
    Moderator

    Hello,

    As I said above, you should assign the term ID to the condition value, not "Solo". You can get the term ID in the URL when editing it.
    Screenshot https://imgur.com/mm7LSSI

    #47841
    JoshJosh
    Participant

    Hi Peter and MB Team,

    Sorry to grave dig here but I'm trying to achieve a similar outcome. Basically, I'm trying to get a custom field group to only show up when the CPT has a specific taxonomy. I tried following the guide above but the custom field doesn't show up even with condition logic set to visible when field group ID = term ID

    Here's a loom video to show: https://www.loom.com/share/87d97b0908924d409579df2c2de06561

    #47846
    PeterPeter
    Moderator

    Hello Josh,

    Using field group ID = term ID when you have a taxonomy field. Please follow steps below to setup the conditional logic for your case:

    1. Create a new field group and add a taxonomy field, select the product category taxonomy for the field.

    2. Edit the Featured Product field group and show/hide the field group based on the taxonomy field ID in step 1.

    #47853
    JoshJosh
    Participant

    Hi Peter,

    Thank you for your response! I didn't realize that there's a taxonomy custom field so thanks for pointing that out.

    Can you please clarify what I need to put in the "field ID" and "value" fields? http://prntscr.com/8UCPdx48vcuL

    I created new field group Product Category http://prntscr.com/8UCPdx48vcuL , I tried putting product_category in the field ID since that's the taxonomy custom field ID but I'm not sure what to put in the "value". I tried putting "Featured" in the value but it still doesn't show the Featured Product Field Group.

    Thanks for your help.

    #47875
    PeterPeter
    Moderator

    Hello,

    You can add the term ID to the conditional logic value. When editing the term, you can get the ID in the URL. Please check 2 screenshots here https://imgur.com/a/vsSJfZ5

Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.