Can anyone help? I want to hide the colour swatch (see attached)
Thanks in advance
A user seeks help hiding color swatches on product pages when only one color option is available.
Initial Solution Provided:
product.liquid file{% if product.options.size > 1 %} with {% if product.options.size > 1 or product.options.first.values.size > 1 %} around the color swatch display codeComplication:
product.liquid fileproduct-variant-picker.liquidCurrent Status:
Please follow the steps as described below:
Open product.liquid file
find the below code:
{% if product.options.size > 1 %} {% endif %}
{% if product.options.size > 1 or product.options.first.values.size > 1 %}
{% endif %}
Let me know if you face any issue.
Thanks so much for your reply, my theme doesnt seem to have a product.liquid file ?
Im using theme “be yours”
I do have product-variant-picker.liquid?
Code is :
{% comment %}
Renders product variant-picker
Accepts:
- product: {Object} product object.
- block: {Object} passing the block information.
- update_url: {Boolean} whether or not to update url when changing variants. If false, the url isn't updated. Default: true (optional).
Usage:
{% render 'product-variant-picker', block: block, product: product %}
{% endcomment %}
{%- unless product.has_only_default_variant -%}
{%- if block.settings.picker_type == 'button' -%}
{%- else -%}
{%- endif -%}
{%- endunless -%}
I can do for you
Sorry to say, By checking this code I am not able to give you an accurate answer. I have to check your theme code and all files related to the product page. By checking the theme code I can give you the accurate answer from where I can hide the color swatch if there is only one color variant is available.
It could be this?
product-variant-picker
{% comment %}
Renders product variant-picker
Accepts:
- product: {Object} product object.
- block: {Object} passing the block information.
- update_url: {Boolean} whether or not to update url when changing variants. If false, the url isn't updated. Default: true (optional).
Usage:
{% render 'product-variant-picker', block: block, product: product %}
{% endcomment %}
{%- unless product.has_only_default_variant -%}
{%- if block.settings.picker_type == 'button' -%}
{%- else -%}
{%- endif -%}
{%- endunless -%}