Hide Colour Swatch - When only one option

Topic summary

A user seeks help hiding color swatches on product pages when only one color option is available.

Initial Solution Provided:

  • Modify product.liquid file
  • Replace the condition {% if product.options.size > 1 %} with {% if product.options.size > 1 or product.options.first.values.size > 1 %} around the color swatch display code

Complication:

  • The user’s theme doesn’t have a product.liquid file
  • Instead uses product-variant-picker.liquid
  • Code snippets were shared but appear corrupted/reversed in the thread

Current Status:

  • The responder acknowledges they cannot provide an accurate solution without examining the full theme code and related product page files
  • Another user offers assistance
  • Discussion remains unresolved as the specific implementation depends on the theme’s file structure and variant picker logic
Summarized with AI on November 20. AI used: claude-sonnet-4-5-20250929.

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

Thanks in advance

1 Like

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.

1 Like

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