Hide Colour Swatch - When only one option

Can anyone help? I want to hide the colour swatch (see attached)

Thanks in advance

Please follow the steps as described below:

  1. Open product.liquid file

  2. find the below code:

{% if product.options.size > 1 %} {% endif %}

  1. replace it with as per below:

{% 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 -%}