Created
November 27, 2024 15:47
-
-
Save odessy/246326e03efae22a26aade1b2ab48750 to your computer and use it in GitHub Desktop.
Swatch colors available
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| {%- liquid | |
| assign swatch_option = nil | |
| if settings.swatches_enable | |
| assign swatch_translation = 'general.swatches.color' | t | |
| assign swatch_labels = swatch_translation | append: ',' | split: ',' | |
| for label in swatch_labels | |
| assign sanitized_label = label | lstrip | rstrip | |
| if product.options_by_name[sanitized_label].values.size > 0 | |
| assign swatch_option = product.options_by_name[sanitized_label] | |
| break | |
| endif | |
| endfor | |
| endif | |
| -%} | |
| {%- if swatch_option != blank -%} | |
| <div class="grid__swatch__container"> | |
| <p class="grid__swatch__placeholder_custom">{{ 'collections.general.swatches_with_count' | t: count: swatch_option.values.size }}</p> | |
| </div> | |
| {%- endif -%} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment