Home > Blockchain >  Learning Liquid - Shopify (where is issue on this code section)
Learning Liquid - Shopify (where is issue on this code section)

Time:02-12

im learning liquid language, and using visual code editor, i'm folliwing rules about writting with, but at the moment it shows me some issue on this section code, its about "Liquid syntax error (line 18): 'for' tag was never closed"

anyone is able to tell me where can i fix that?

<div >
  <div >
    {%- liquid
   for block in section.blocks 
     case block.settings.width 
      when '25%'
        assign block_width = 'small--one-whole one-quarter' 
      when '33%'
        assign block_width = 'small--one-whole one-third'
      when '50%'
        assign block_width = 'small--one-whole one-half'
      when '66%'
        assign block_width = 'small--one-whole two-thirds' 
      when '75%'
         assign block_width = 'small--one-whole three-quarters'
       when '100%' 
         assign block_width = 'one-whole' 
    endcase -%}
    <div id="section-block-returns"  {{ block.shopify_attributes }}>
      <div >
        <div >
          {{ block.settings.code }}
        </div>
      </div>
    </div>
  {% endfor %}
  </div>
</div>

CodePudding user response:

You forgot to close the 'for loop' with the closing tag 'endfor', place it right after the 'endcase' closing tag. Like this:

{%- liquid
 for block in section.blocks 
   case block.settings.width 
    when '25%'
      assign block_width = 'small--one-whole one-quarter' 
    when '33%'
      assign block_width = 'small--one-whole one-third'
    when '50%'
      assign block_width = 'small--one-whole one-half'
    when '66%'
      assign block_width = 'small--one-whole two-thirds' 
    when '75%'
       assign block_width = 'small--one-whole three-quarters'
     when '100%' 
       assign block_width = 'one-whole' 
    endcase 
  endfor -%}

Hopefully it will work now

  • Related