Trend Snaps
Trend Snaps

Reputation: 198

shopify Liquid error: Memory limits exceeded

I was trying to display all the product types of my site in one page , 2 days back it was listing all the all the product type.

But now when that page is loads its giving error like "shopify Liquid error: Memory limits exceeded"

Here is my code

<div class="rte">
     {{ page.content }}
   <ul class="vendor-list block-grid three-up mobile one-up">
     {% for product_type in shop.types %}
     {% assign its_a_match = false %}

     {% capture my_collection_handle %} {{ type | handleize | strip | escape  }}       {% endcapture %}
     {% assign my_collection_handle_stripped = my_collection_handle | strip | escape %}

     {% for collection in collections %}
     {% if my_collection_handle_stripped == collection.handle %}
     {% assign its_a_match = true %}
     {% endif %}
     {% endfor %}

     {% if its_a_match %} 
    <li class="vendor-list-item"><a href="/collections/{{ product_type | handleize }}">{{ product_type }}</a></li>
     {% endif %}
     {% endfor %}
     </ul>
     </div>

how can i overcome this problem ?

Upvotes: 0

Views: 3977

Answers (1)

HymnZzy
HymnZzy

Reputation: 2925

Try the following. It's faster and more efficient.

<div class="rte">
    {{ page.content }}
    <ul class="vendor-list block-grid three-up mobile one-up">
    {% for product_type in shop.types %}

    {% assign type = product_type | strip | escape | handleize %}

    {% assign collection = collections[type] %}

    {% if collection.handle != '' %}
        <li class="vendor-list-item"><a href="/collections/{{ collection.handle }}">{{ product_type }}</a></li>
    {% endif %}

    {% endfor %}
    </ul>
</div>

Upvotes: 1

Related Questions