So imagine this scenario
Merchant wants to display Color option values first in the form even if the VAs messed up the order in the product admin
So even if they set it up Size then Color it should always display Color first
{% assign actual_order = "Fit, Size, Color" | strip | split: ',' %}
{% assign preferred_order = "Color, Size, Fit" | strip | split: ',' %}
{% assign final_order = "" %}
{% for value in preferred_order %}
{% if actual_order contains value %}
{% assign final_order = final_order | append: value | append: ',' %}
{% endif %}
{% endfor %}
But my God, it’s prone to so much bugs, we could forget values, they could misspel the options, etc.. let alone the unneccissary looping
If you had this challenge, how would you approach it?