The colors should be rendered as radio buttons with a background color of different products are listed in en.default.json. I want to separate the colors displayed on the product page as limited edition colors and essentials as shown on the Girlfriend website
"colors": {
"white": "FFFFFF",
"black": "000000",
"raw": "707070"
}
The following is the code to force colors from the en.default.json in the locales directory:
{% assign value_handle = value | handleize %}
{% assign color_translation_key = 'product.colors.' | append: value_handle %}
{% assign color_hex = color_translation_key | t %}
{% unless color_hex contains 'translation missing' %}
<span class="option-color color-{{ value_handle }}">
<span class="option-color-inner">
<span class="color-swatch" style="background-color: {{ color_hex | prepend: '#' }};">
</span>
<span class="visually-hidden">
{{ value }}
</span>
</span>
</span>
{% else %}
{{ value }}
{% endunless %}
The color options are rendered as radio buttons in the product page if the product has a color option:
{% for value in option.values %}
{% assign radio_id = 'option-' | append: option_name | append: '-' | append: value | handleize %}
<input class="variant-radio" id="{{ radio_id }}" type="radio" name="{{ option_name }}" value="{{ value }}" {% if value == selected %}checked{% endif %}>
<label for="{{ radio_id }}">
{% if force_colors == true %}
{% include 'option-color' with color: value %}
{% else %}
{{ value }}
{% endif %}
</label>
{% endfor %}
