Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
How do I insert an object into an array of objects?
I have a for loop that is looping through one array and I have code that is filtering it by some properties to extract the objects that I need from it, the issue is that I want these objects to also be in an array:
{% for uniqueVariant in uniqueVariants %}
{% assign uniqueFirstAvailableVariants = product.variants | where: "option1", variants[forloop.index] | where: "available", true | first %}
{% endfor %}
So how do I initialize uniqueFirstAvailableVariants as an empty array and then just insert the matching objects in it? Because right now uniqueFirstAvailableVariants is giving me just one object and it is the last object that is found that matches the conditions (and tha tis expected since its not an array)
Dropshipping, a high-growth, $226 billion-dollar industry, remains a highly dynamic bus...
By JasonH Nov 27, 2024Hey Community! It’s time to share some appreciation and celebrate what we have accomplis...
By JasonH Nov 14, 2024In today’s interview, we sat down with @BSS-Commerce to discuss practical strategies f...
By JasonH Nov 13, 2024