Support » Plugin: Meta Box - WordPress Custom Fields Framework » Conditionally display checkbox list based on another checkbox list

  • Hello,

    I would like to combine MB Custom Taxonomy, MB Term Meta and MB Conditional Logic functionality.
    I’ve read the docs and found Meta Box plugins very useful, but it’s still not clear to me if my case could be solved.

    Here’s the case:
    1. There are 2 custom taxonomies: “Brand” and “Model”. These taxonomies are bound to Woocommerce products.
    2. “Model” terms have “brand_id” field, that references “Brand” taxonomy term (one “Brand” has many “Models”, one “Model” belongs to one “Brand”).
    3. On Woocommerce “Add Product” page a meta box is displayed. It has “Brand” taxonomy terms listed as “taxonomy” field with “field_type” set to “checkbox_list”. Also, there are multiple hidden taxonomy checkbox lists filtered by “brand_id” (i.e. list of “Samsung” models, list of “Apple” models etc.). When user selects some brand, the “Samsung” model list is displayed. When user selects multiple brands – i.e. “Apple” and “Samsung” – both “Apple” and “Samsung” model lists are displayed.

    So, as I’ve read from the docs:
    1. Can be easily achieved using MB Custom Taxonomy plugin.
    2. Can be easily achieved using MB Term Meta plugin.
    3. I couldn’t find any guide on displaying particular field when one of the checkboxes from taxonomy checkbox list is checked. Is it possible to do so using MB Conditional Logic plugin?

    I’ve tried to ask my question using contact form on but it seems like it’s not working. When I press “Submit” button the spinner appears and stays there forever.

    Best Regards,

    • This topic was modified 4 years, 6 months ago by fakemeta.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi Roman,

    Looks like your problem is similar to what shown in the introduction page of MB Conditional Logic, just the checkbox_list instead of the select dropdown.

    Regarding the checkbox list, yes, the MB Conditional Logic extension works well with it. You can create each list of models (which is a taxonomy field with type of checkbox_list also) for each brand, and for those model lists, you just need to add a condition like this:

    'visible' => ['brand_field_id', 'Brand name']

    That’s all.

    If you have any question, please let me know. And thanks for the mentioning of the contact form. I will check it.

    Plugin Author Anh Tran


    Oh, just replied under the wrong username 🙂

    Thread Starter fakemeta


    Hello Anh

    Yes, I’ve seen the example of MB Conditional Logic plugin. That’s the thing that made me dig into your plugins because I’ve ran into them by accident when googling how to load meta box content via ajax, and found out that my case may be implemented with much less effort.

    Nice to hear that MB Conditional Logic can solve my problem, but my brands checkbox_list field is a taxonomy field rendered as multiple <input value="$brand_id" type="checkbox" name="brand_taxonomy[]"> tags. So, basically, by setting 'visible' => ['brand_taxonomy', '$brand_id'] I’m telling the plugin to perform something like brand_taxonomy.indexOf(brand_id) check on the client side? Or does it use field labels instead of input values to check for array occurrences (coming from your example)?

    • This reply was modified 4 years, 6 months ago by fakemeta.
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Conditionally display checkbox list based on another checkbox list’ is closed to new replies.