Shopify / theme-check

The Ultimate Shopify Theme Linter
Other
333 stars 96 forks source link

Variables assigned in capture are incorrectly recognized as unused #748

Closed bakura10 closed 8 months ago

bakura10 commented 8 months ago

Hi,

The following code is used to goes around limitation in Liquid form to get the status without outputting an actual form (Liquid should provide better solution, but for now this is the only approach I found):

{%- capture temporary -%}
      {%- form 'customer', id: newsletter_id, class: 'form' -%}
        {%- assign posted_successfully = form.posted_successfully? -%}
      {%- endform -%}
    {%- endcapture -%}

    <newsletter-popup {% if posted_successfully %}open{% endif %}>
</newsletter-popup>

Error:

image