Exceeded maximum number of unique handles for all_products.

Highlighted
Shopify Partner
3 0 0

I am having this errors form shopify Liquid error from shopify on my project. and i don't know to how its comes
If shopify experts have this errors solution please comment

 

Thanks

Nitesh K

0 Likes
Highlighted
Explorer
258 0 23

Usually because you've got too many variants. There is a 100 maximum.

0 Likes
Highlighted
Shopify Partner
3 0 0

HI,
Adrian


I know this we just used 100 variants

I am using this code and its work for some product but some products not working and giving the Liquid error

It is the code we used for showing the related product on the account page

{% capture related_charger %}{% for order in customer.orders %}{% for line_item in order.line_items %}{% if line_item.product.metafields.related_chargers.related_chargers != blank %}|{{ line_item.product.metafields.related_chargers.related_chargers }}{% endif %}{% endfor %}{% endfor %}{% endcapture %}
{% assign new_handle = related_charger | remove_first: '|' %}
{% assign new_handle = related_products  | split: ',' %}
{% if related_products.size > 0 %}
    {% for product_handle in related_products %}
        {% assign product = all_products[product_handle] %}
        {{ product.title }}
    {% endfor %}
{% endif %}

In this code we are fetching the product by product heandle with the metafield app. and passes the heandle in array.

But when  some products it gives this errors "Exceeded maximum number of unique handles for all_products"

but in the array of the product heandle is only 15 proudcts heandle 
and it print only 12 product after that its give this error.

Now my question is:

Is any limt  for the all_product globle  variable which fetch limited product on per page??

Thanks 
 

0 Likes
Highlighted
Shopify Expert
10006 116 1818

all_products has a usage limit of 20 unique handles per page.

That tag is not intended to replace a collection so consider it for small use needs only. I'd assume your code is looping over many things and using all_products with more than 20 unique handles. If that's the case, that's why you'd be seeing the error.

★ Winning Partner of the Build a Business competition. ★ http://freakdesign.com.au
Highlighted
New Member
1 0 0

Is this limitation a recent change? We have quite a few stores built and we don't recall this problem coming up in the past. 

0 Likes
Highlighted
Shopify Expert
4265 32 434

I have seen the limit for almost the entire time the method has existed. Nothing new there. Was never unlimited. It is a bit of a downer as a limit goes. 

No matter how much you explain that as an available method it fills in a glaring weakness in collections, there is a refusal to increase the limit. I adapted to that and find that since it works with 20, 20 it is, and that 20 is used in ways NO COLLECTION can ever beat, since there are some patterns you cannot do elegantly with collections.

Custom Shopify Apps built just for you! hunkybill@gmail.com http://www.resistorsoftware.com
Highlighted
Shopify Partner
16 0 2

I have a product that I use as a bundle of other products. Bundle contents are defined with metafields.
I have a bundle of 30 products, so 30 metafields contain 30 product handles. 
all_products has a limit of 20 products per page.

Now, how can I show all 30 products that the bundle contains on the bundle page? 
How do I work-around this limitation?

0 Likes