All things Shopify and commerce
I'm attempting to sort my array by the value of my order field in my metaobject. For example, each brand entry has brand.order which is an integer. How can i access these values and sort them before my for loop runs?
{% assign sorted_brands = shop.metaobjects.brands.values | sort: 'order' %} {% for brand in sorted_brands %} {% if brand.category == category %} <li class="flex items-center justify-center"> <a href="{{ brand.url }}" target="_blank" class="max-h-[44px] w-auto flex items-center justify-center"> <img srcset="{{ brand.logo.value | image_url }}" src="{{ brand.logo.value | image_url }}" alt="{{ brand.name }}" height="44" width="86" class="max-h-[44px] w-auto" loading="lazy" > </a> </li> {% endif %} {% endfor %}
Starting a B2B store is a big undertaking that requires careful planning and execution. W...
By JasonH Sep 23, 2024By investing 30 minutes of your time, you can unlock the potential for increased sales,...
By Jacqui Sep 11, 2024We appreciate the diverse ways you participate in and engage with the Shopify Communi...
By JasonH Sep 9, 2024