Custom Fields
Re-Envisioned
Support Meta Box Conditional Logic Conditional logic not working for nested items in repeating group

  • Creator
    Topic
  • #22029
    Caballero
    Participant

    Hello!

    Here is the code snippet:
    https://pastebin.com/xNkLYDMv

    To replicate issue:
    Add two sections: Product info and then Pricing.
    In Pricing section choose type of Table.
    The problems is than in Plans there should be Features but they aren't showing.
    Also the Enable Icons switch isn't toggling fields.
    Is this expected behavior or a bug?
    I tested the same structure in ACF and it's working there.

    Thanks!

Viewing 6 replies - 1 through 6 (of 6 total)
  • Author
    Replies
  • #22036
    Long Nguyen
    Moderator

    Hi,

    I've tested your code on my local site but not see any problem. See this screen record https://www.loom.com/share/e1123f4c1f664c088ff50612ef4e9f9f.

    Please make sure that the plugin Meta Box Group (or Meta Box AIO) is activating, deactivate all plugins except Meta Box, Meta Box extensions, WooCommerce; switch to the default theme of WordPress (Twenty Twenty) and clear cache then check the problem again.

    #22071
    Caballero
    Participant

    Hello!

    I see that you only have added one section, if I add only one section the conditional logic is working as expected but problem starts when the section isn't the first section in the repeating group.
    I have recorded video to help you understand my problem:
    https://www.loom.com/share/de7dfc8950db4a928cd53a53cbc5a492
    I'm not using WooCommerce product is CPT but that isn't important as you can add fields to page or post and the problem is persistent.
    Meta Box AIO is activating. I have deactivated all plugins except MetaBox and MetaBox AIO updated to latest version. Cleared the cache and tested this on default theme, still not working.

    Thanks!

    #22094
    Long Nguyen
    Moderator

    Hi,

    Thanks for pointing this out. The conditional logic only works with the field group, not the sub-field inside the group. So please use a field that has the same level (depth) to make the conditional works.

    Move the condition from field id features up to the field id plan, the code should be https://pastebin.com/VZee1zU7. You can do the same for other fields/groups.

    #22095
    Caballero
    Participant

    Hello!

    It's unfortunate to hear that this kind of behavior isn't expected as I didn't want to repeat the same field declarations for all possible outcomes of this solution (Now I have to and there is a lot of WET code). Also I wanted to avoid copying data if there is change in any of options. Only type switch would result in two separate groups with separate ID's...
    Is it possible that in future you'll integrate functionality like this?
    As I mentioned before ACF seems to support this kind of behavior and we decided to choose MetaBox over ACF because of your advertising of boundless features and endless possibilities.

    Thanks!

    #22098
    Long Nguyen
    Moderator

    Hi,

    I'm going to pass this case for the developer team to research and cover it in the next update as soon as possible. Thank you.

    #22133
    Caballero
    Participant

    Hello!

    Thanks for supporting this feature request. We'll be waiting for update to roll out!

    Regards,
    Caballero team.

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