I have a metaobject called color that stores additional information about the colorways my products come in (description, marketing image, etc). Currently, I am handelizing and matching the product’s variant color names with the names of the metaobject to show this stuff:
I have a product with more than 20 colors and after the 20th I see this error on the PDP:
Liquid error (snippets/product-variant-options line 70): Exceeded maximum number of unique handles for color.
I know that there is a limit of 20 unique handles with all_products on a page, is there also a limit of metaobject handles? Is there a limit if using GraphQL?
What the heck. This issue is still not resolve. I just encountered it right now as we shifting our catalog to be more dynamic. I thought that with an explicit calling as the code know which handle to pull from the parent metaobject definition should be enough to call it once and don’t have a limit, unlike for loops. This is so hand bound limitation from Shopify.
Liquid error (snippets/option-value line 82): Exceeded maximum number of unique handles for shopify–color-pattern.
We’ve added custom code to support the native colors swatches based on metaobjects for bundles as well.
When there is a lot of color options, the last ones don’t show.
However, many colors are duplicate, so the amount of unique handles is under 20, so I don’t understand why the limit would be reached at all:
What is there to do?
While I think the limit is too low or I am missing a great workaround, we should not even hit that limit.
Especially, since it is the metaobject for the native color swatches!
Since the creation of this thread, other ones were created as well:
Fixed it by switching to looping through metaobject using the paginate tag, to increase the limit to over 50.
I feel like this is vastly more inefficient than getting the metaobject entries by their unique handle, so I hope the limit for this is increased in the future.
I also figured out, that the error message was misleading. While it contained a reference to the metaobject I was querying when the error appeared, it seems to be a global limit of 20 unique handle lookups. Doesn’t matter if those are for metaobjects or also metafields.