Visible_if - expand to include heading/paragraphs

Hiya,

So the new “visible_if” property for sections is great, however it doesn’t appear to be compatibile with paragraphs - meaning that you get strange behaviour if you have headings/paragraphs but all of the options in that area are hidding.

As an example:

{
    "type": "paragraph",
    "content": "Button 3",
    "visible_if": "{{ block.settings.link == blank }}"
},
1 Like

Hey @ceri_waters :waving_hand: Thanks for flagging this.

I’m happy to check into this and confirm if something’s up here for sure. Just for reproduction steps on my end here to see if I can see what you’re seeing, if you’re able to share the shop ID with the theme where you’re seeing this, I can try to replicate on my end and confirm expected behaviour.

Hope to hear from you soon!

Hi Alan,
Apologies it was just when I was working on the theme locally - it’s not seen as a valid property by Shopify

1 Like

Thanks for clarifying @ceri_waters, just wanted to follow up here to confirm I’m looking into this on our end, I’ll loop back with you once I can confirm this is expected behaviour.

This seems to be fixed for section and block, but I just noticed that type:heading is ignoring visible_if in global settings.


Here’s some reproduction code:

Global:

      {
        "type": "checkbox",
        "id": "do_complex_thing",
        "label": "Do something complicated",
        "info": "This is going to require a lot of explaining",
        "default": false
      },
      {
        "type": "header",
        "content": "Header about complicated thing",
        "info": "This is going to ignore the visible_if",
        "visible_if": "{{ settings.do_complex_thing == true }}"
      },
      {
        "type": "paragraph",
        "content": "Visible if works for content type paragraph in global settings",
        "visible_if": "{{ settings.do_complex_thing == true }}"
      },

This is separate, and much lower priority but the in-browser syntax highlighter is throwing errors on valid code:

Block, section, and global all think paragraph is not allowed:

Global can’t find props of the settings object (not getting this on section/block)

One more quirk - settings type:link_list does not respond to visible_if:

    {
      "id": "show_menu",
      "type": "checkbox",
      "label": "Show menu",
      "default": false,
    },
    {
      "id": "menu",
      "type": "link_list",
      "label": "Menu",
      "info": "Always shows",
      "default": "footer",
      "visible_if": "{{ section.settings.show_menu }}"
    },


@Alan_G Hiya, any updates?

Hi @ceri_waters - thanks for following up and @Gideon for your messages here too. I still don’t have a concrete update to share here, but I’ve pinged our product team on this just now to see if we can look into this more quickly for you.

I still can’t guarantee a turnaround time, but just wanted to follow up here to mention that I am looking into this on my end still. I will loop back here once I have some next steps. :slight_smile:

1 Like

i opened an issue : Conditional settings (visible_if) not working on sidebar settings · Issue #999 · Shopify/theme-tools · GitHub

Thanks @Adonis - appreciate you setting that up. I’ve reached out to the team again on my end here to see if we can get this looked at as well. I’ll keep an eye on this for you folks and get in touch as soon as I have more info.

1 Like

Hi @ceri_waters and all - I’ve connected with our product team on this. I jsut wanted to confirm, are you able to save the paragraph, but are just encountering the issue during theme check? Just wanted to confirm if it was impeding your workflow completely there - hope to hear from you soon!

@Alan_G So I tried this out I can save it, but the paragraph doesn’t seem to show even when the conditions are met.

So it’s both a theme check issue, and liquid issue I guess?

Thanks @ceri_waters - just wanted to double check that this was affecting things on the Liquid side as well. I’ll keep looking into this and loop back with you and everyone in this thread once I have more to share.

Hey @ceri_waters - just tagging you here again, I’m going to DM you to reach out about some specifics on your shop so we can dig into this further, speak with you soon there!

@Gideon This was recently resolved - let me know in case link_list is still causing issues.

Hello @misha, for reference I created a Github issue a few weeks ago on the Liquid repo regarding this exact link_list bug with visible_if parameter. Feel free to close it / let me know if you want it closed

1 Like

I have noticed that header elements do not work either. Has anyone else experienced this?

product list doesn’t work for me either.