Liquid Question: Sorting Metafields by Unit

3 0 0



I am new to Liquid, however, I have been searching the docs, and I am still having some trouble.


What would the syntax look like for sorting metafields by their unit of measurement? I have the metafields I want to display in the namespace `specs.`.


Here is the current liquid I have written:

{% if product_specs.size > 0 %}
  <div id="specifications">
      {% for spec in product.metafields.specs -%}
        <li><strong>{{ spec.first | capitalize }}</strong>: {{ spec.last.value }}</li>
      {%- endfor %}
{% endif %}


Here is the output:

Height: 55 mm
Weight: 2 oz
Width: 25 mm


So, I want Height and Width displayed next to each other, any thoughts or help on this would be greatly appreciated! 

Replies 0 (0)