How to determine all uses of all_products in Shopify?










0














We have a page on a Shopify store that is triggering this error, despite very careful logic to keep the number of unique uses of all_products under the maximum of 20:



Liquid error: Exceeded maximum number of unique handles for all_products.


Other pages that use the same templates are working fine, so something unique about this page is causing one extra all_products reference. (I know it's only off by one because the error happens between what I expect to be the 19th and 20th reference to the object.)



Despite tracing through our code, I cannot figure out where the extra reference is happening. Is there any way to definitively identify where all references across a page are happening, or even just what handles have been referenced?










share|improve this question





















  • It will be hard to help you without any code. You will need to review your header/footer/template/layout/snippets that are used on this page in case you call all_products any where additionally. Test with 20 hardcoded request to check if they pass, if they don't the problem is outside the section you are sure it works, but if it pass then the section in question is the problem.
    – drip
    Nov 13 '18 at 7:36











  • Right, I know the problem is outside the section I'm working on. I already looked at the header, footer, etc. (I searched the code for every use of all_products and traced back from there how it was included.) Evidently I missed something, but that's why my question here is whether there's a direct way to flag/log all references to the object. I'm used to non-SaaS dev environments that aren't such black boxes.
    – Scott Buchanan
    Nov 13 '18 at 13:50







  • 1




    Probably a bug in Shopify... all_products is super useful, but also something we cannot control...
    – David Lazar
    Nov 13 '18 at 14:56















0














We have a page on a Shopify store that is triggering this error, despite very careful logic to keep the number of unique uses of all_products under the maximum of 20:



Liquid error: Exceeded maximum number of unique handles for all_products.


Other pages that use the same templates are working fine, so something unique about this page is causing one extra all_products reference. (I know it's only off by one because the error happens between what I expect to be the 19th and 20th reference to the object.)



Despite tracing through our code, I cannot figure out where the extra reference is happening. Is there any way to definitively identify where all references across a page are happening, or even just what handles have been referenced?










share|improve this question





















  • It will be hard to help you without any code. You will need to review your header/footer/template/layout/snippets that are used on this page in case you call all_products any where additionally. Test with 20 hardcoded request to check if they pass, if they don't the problem is outside the section you are sure it works, but if it pass then the section in question is the problem.
    – drip
    Nov 13 '18 at 7:36











  • Right, I know the problem is outside the section I'm working on. I already looked at the header, footer, etc. (I searched the code for every use of all_products and traced back from there how it was included.) Evidently I missed something, but that's why my question here is whether there's a direct way to flag/log all references to the object. I'm used to non-SaaS dev environments that aren't such black boxes.
    – Scott Buchanan
    Nov 13 '18 at 13:50







  • 1




    Probably a bug in Shopify... all_products is super useful, but also something we cannot control...
    – David Lazar
    Nov 13 '18 at 14:56













0












0








0







We have a page on a Shopify store that is triggering this error, despite very careful logic to keep the number of unique uses of all_products under the maximum of 20:



Liquid error: Exceeded maximum number of unique handles for all_products.


Other pages that use the same templates are working fine, so something unique about this page is causing one extra all_products reference. (I know it's only off by one because the error happens between what I expect to be the 19th and 20th reference to the object.)



Despite tracing through our code, I cannot figure out where the extra reference is happening. Is there any way to definitively identify where all references across a page are happening, or even just what handles have been referenced?










share|improve this question













We have a page on a Shopify store that is triggering this error, despite very careful logic to keep the number of unique uses of all_products under the maximum of 20:



Liquid error: Exceeded maximum number of unique handles for all_products.


Other pages that use the same templates are working fine, so something unique about this page is causing one extra all_products reference. (I know it's only off by one because the error happens between what I expect to be the 19th and 20th reference to the object.)



Despite tracing through our code, I cannot figure out where the extra reference is happening. Is there any way to definitively identify where all references across a page are happening, or even just what handles have been referenced?







shopify






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 13 '18 at 0:13









Scott BuchananScott Buchanan

418421




418421











  • It will be hard to help you without any code. You will need to review your header/footer/template/layout/snippets that are used on this page in case you call all_products any where additionally. Test with 20 hardcoded request to check if they pass, if they don't the problem is outside the section you are sure it works, but if it pass then the section in question is the problem.
    – drip
    Nov 13 '18 at 7:36











  • Right, I know the problem is outside the section I'm working on. I already looked at the header, footer, etc. (I searched the code for every use of all_products and traced back from there how it was included.) Evidently I missed something, but that's why my question here is whether there's a direct way to flag/log all references to the object. I'm used to non-SaaS dev environments that aren't such black boxes.
    – Scott Buchanan
    Nov 13 '18 at 13:50







  • 1




    Probably a bug in Shopify... all_products is super useful, but also something we cannot control...
    – David Lazar
    Nov 13 '18 at 14:56
















  • It will be hard to help you without any code. You will need to review your header/footer/template/layout/snippets that are used on this page in case you call all_products any where additionally. Test with 20 hardcoded request to check if they pass, if they don't the problem is outside the section you are sure it works, but if it pass then the section in question is the problem.
    – drip
    Nov 13 '18 at 7:36











  • Right, I know the problem is outside the section I'm working on. I already looked at the header, footer, etc. (I searched the code for every use of all_products and traced back from there how it was included.) Evidently I missed something, but that's why my question here is whether there's a direct way to flag/log all references to the object. I'm used to non-SaaS dev environments that aren't such black boxes.
    – Scott Buchanan
    Nov 13 '18 at 13:50







  • 1




    Probably a bug in Shopify... all_products is super useful, but also something we cannot control...
    – David Lazar
    Nov 13 '18 at 14:56















It will be hard to help you without any code. You will need to review your header/footer/template/layout/snippets that are used on this page in case you call all_products any where additionally. Test with 20 hardcoded request to check if they pass, if they don't the problem is outside the section you are sure it works, but if it pass then the section in question is the problem.
– drip
Nov 13 '18 at 7:36





It will be hard to help you without any code. You will need to review your header/footer/template/layout/snippets that are used on this page in case you call all_products any where additionally. Test with 20 hardcoded request to check if they pass, if they don't the problem is outside the section you are sure it works, but if it pass then the section in question is the problem.
– drip
Nov 13 '18 at 7:36













Right, I know the problem is outside the section I'm working on. I already looked at the header, footer, etc. (I searched the code for every use of all_products and traced back from there how it was included.) Evidently I missed something, but that's why my question here is whether there's a direct way to flag/log all references to the object. I'm used to non-SaaS dev environments that aren't such black boxes.
– Scott Buchanan
Nov 13 '18 at 13:50





Right, I know the problem is outside the section I'm working on. I already looked at the header, footer, etc. (I searched the code for every use of all_products and traced back from there how it was included.) Evidently I missed something, but that's why my question here is whether there's a direct way to flag/log all references to the object. I'm used to non-SaaS dev environments that aren't such black boxes.
– Scott Buchanan
Nov 13 '18 at 13:50





1




1




Probably a bug in Shopify... all_products is super useful, but also something we cannot control...
– David Lazar
Nov 13 '18 at 14:56




Probably a bug in Shopify... all_products is super useful, but also something we cannot control...
– David Lazar
Nov 13 '18 at 14:56












1 Answer
1






active

oldest

votes


















1














I've run into this bug and it sucks.



No way to output the number in liquid I'm aware, other than using increment after each all_products and seeing what it spits out.



In section theme settings, have worked around this a number of ways, none of which are as easy as product picker though.



Down and dirty, you could swap the product picker for a text input and have the client add the product handle there, and render it with JS.



I've found the more client-friendly approach is a collection same name as page, have them use collection picker, and make the liquid work to populate the 20(+) products in the order you want. Have them arrange the order from within the collection.






share|improve this answer




















  • > Down and dirty, you could swap the product picker for a text input and have the client add the product handle there, and render it with JS. Note: When you use the product picker, the settings value is actually the handle of the product - You can drop that handle into your Javascript to load your details asynchronously, as well
    – Dave B
    Nov 14 '18 at 17:15










  • Also, I definitely agree with your advice of using collections whenever possible - they're a much better way to get an arbitrary large number of products into play, and the ability to specify the sort method on collections in a variety of ways is such a nice bonus :)
    – Dave B
    Nov 14 '18 at 17:18










  • In our case we're actually constructing this dynamically from products selected in a custom field (using Accentuate Custom Fields). In this case our "down and dirty" solution was to simply display fewer products (16 rather than 20), though had we had the time, AJAX would have been the ideal approach.
    – Scott Buchanan
    Nov 15 '18 at 22:45











Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53271960%2fhow-to-determine-all-uses-of-all-products-in-shopify%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









1














I've run into this bug and it sucks.



No way to output the number in liquid I'm aware, other than using increment after each all_products and seeing what it spits out.



In section theme settings, have worked around this a number of ways, none of which are as easy as product picker though.



Down and dirty, you could swap the product picker for a text input and have the client add the product handle there, and render it with JS.



I've found the more client-friendly approach is a collection same name as page, have them use collection picker, and make the liquid work to populate the 20(+) products in the order you want. Have them arrange the order from within the collection.






share|improve this answer




















  • > Down and dirty, you could swap the product picker for a text input and have the client add the product handle there, and render it with JS. Note: When you use the product picker, the settings value is actually the handle of the product - You can drop that handle into your Javascript to load your details asynchronously, as well
    – Dave B
    Nov 14 '18 at 17:15










  • Also, I definitely agree with your advice of using collections whenever possible - they're a much better way to get an arbitrary large number of products into play, and the ability to specify the sort method on collections in a variety of ways is such a nice bonus :)
    – Dave B
    Nov 14 '18 at 17:18










  • In our case we're actually constructing this dynamically from products selected in a custom field (using Accentuate Custom Fields). In this case our "down and dirty" solution was to simply display fewer products (16 rather than 20), though had we had the time, AJAX would have been the ideal approach.
    – Scott Buchanan
    Nov 15 '18 at 22:45
















1














I've run into this bug and it sucks.



No way to output the number in liquid I'm aware, other than using increment after each all_products and seeing what it spits out.



In section theme settings, have worked around this a number of ways, none of which are as easy as product picker though.



Down and dirty, you could swap the product picker for a text input and have the client add the product handle there, and render it with JS.



I've found the more client-friendly approach is a collection same name as page, have them use collection picker, and make the liquid work to populate the 20(+) products in the order you want. Have them arrange the order from within the collection.






share|improve this answer




















  • > Down and dirty, you could swap the product picker for a text input and have the client add the product handle there, and render it with JS. Note: When you use the product picker, the settings value is actually the handle of the product - You can drop that handle into your Javascript to load your details asynchronously, as well
    – Dave B
    Nov 14 '18 at 17:15










  • Also, I definitely agree with your advice of using collections whenever possible - they're a much better way to get an arbitrary large number of products into play, and the ability to specify the sort method on collections in a variety of ways is such a nice bonus :)
    – Dave B
    Nov 14 '18 at 17:18










  • In our case we're actually constructing this dynamically from products selected in a custom field (using Accentuate Custom Fields). In this case our "down and dirty" solution was to simply display fewer products (16 rather than 20), though had we had the time, AJAX would have been the ideal approach.
    – Scott Buchanan
    Nov 15 '18 at 22:45














1












1








1






I've run into this bug and it sucks.



No way to output the number in liquid I'm aware, other than using increment after each all_products and seeing what it spits out.



In section theme settings, have worked around this a number of ways, none of which are as easy as product picker though.



Down and dirty, you could swap the product picker for a text input and have the client add the product handle there, and render it with JS.



I've found the more client-friendly approach is a collection same name as page, have them use collection picker, and make the liquid work to populate the 20(+) products in the order you want. Have them arrange the order from within the collection.






share|improve this answer












I've run into this bug and it sucks.



No way to output the number in liquid I'm aware, other than using increment after each all_products and seeing what it spits out.



In section theme settings, have worked around this a number of ways, none of which are as easy as product picker though.



Down and dirty, you could swap the product picker for a text input and have the client add the product handle there, and render it with JS.



I've found the more client-friendly approach is a collection same name as page, have them use collection picker, and make the liquid work to populate the 20(+) products in the order you want. Have them arrange the order from within the collection.







share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 14 '18 at 6:51









RadiatorRadiator

113




113











  • > Down and dirty, you could swap the product picker for a text input and have the client add the product handle there, and render it with JS. Note: When you use the product picker, the settings value is actually the handle of the product - You can drop that handle into your Javascript to load your details asynchronously, as well
    – Dave B
    Nov 14 '18 at 17:15










  • Also, I definitely agree with your advice of using collections whenever possible - they're a much better way to get an arbitrary large number of products into play, and the ability to specify the sort method on collections in a variety of ways is such a nice bonus :)
    – Dave B
    Nov 14 '18 at 17:18










  • In our case we're actually constructing this dynamically from products selected in a custom field (using Accentuate Custom Fields). In this case our "down and dirty" solution was to simply display fewer products (16 rather than 20), though had we had the time, AJAX would have been the ideal approach.
    – Scott Buchanan
    Nov 15 '18 at 22:45

















  • > Down and dirty, you could swap the product picker for a text input and have the client add the product handle there, and render it with JS. Note: When you use the product picker, the settings value is actually the handle of the product - You can drop that handle into your Javascript to load your details asynchronously, as well
    – Dave B
    Nov 14 '18 at 17:15










  • Also, I definitely agree with your advice of using collections whenever possible - they're a much better way to get an arbitrary large number of products into play, and the ability to specify the sort method on collections in a variety of ways is such a nice bonus :)
    – Dave B
    Nov 14 '18 at 17:18










  • In our case we're actually constructing this dynamically from products selected in a custom field (using Accentuate Custom Fields). In this case our "down and dirty" solution was to simply display fewer products (16 rather than 20), though had we had the time, AJAX would have been the ideal approach.
    – Scott Buchanan
    Nov 15 '18 at 22:45
















> Down and dirty, you could swap the product picker for a text input and have the client add the product handle there, and render it with JS. Note: When you use the product picker, the settings value is actually the handle of the product - You can drop that handle into your Javascript to load your details asynchronously, as well
– Dave B
Nov 14 '18 at 17:15




> Down and dirty, you could swap the product picker for a text input and have the client add the product handle there, and render it with JS. Note: When you use the product picker, the settings value is actually the handle of the product - You can drop that handle into your Javascript to load your details asynchronously, as well
– Dave B
Nov 14 '18 at 17:15












Also, I definitely agree with your advice of using collections whenever possible - they're a much better way to get an arbitrary large number of products into play, and the ability to specify the sort method on collections in a variety of ways is such a nice bonus :)
– Dave B
Nov 14 '18 at 17:18




Also, I definitely agree with your advice of using collections whenever possible - they're a much better way to get an arbitrary large number of products into play, and the ability to specify the sort method on collections in a variety of ways is such a nice bonus :)
– Dave B
Nov 14 '18 at 17:18












In our case we're actually constructing this dynamically from products selected in a custom field (using Accentuate Custom Fields). In this case our "down and dirty" solution was to simply display fewer products (16 rather than 20), though had we had the time, AJAX would have been the ideal approach.
– Scott Buchanan
Nov 15 '18 at 22:45





In our case we're actually constructing this dynamically from products selected in a custom field (using Accentuate Custom Fields). In this case our "down and dirty" solution was to simply display fewer products (16 rather than 20), though had we had the time, AJAX would have been the ideal approach.
– Scott Buchanan
Nov 15 '18 at 22:45


















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53271960%2fhow-to-determine-all-uses-of-all-products-in-shopify%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







這個網誌中的熱門文章

Barbados

How to read a connectionString WITH PROVIDER in .NET Core?

Node.js Script on GitHub Pages or Amazon S3