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)