Why doesn't the color swatch update if I change the file?

Edited

We cache color swatch files so they load faster since they won't change often. The trade off is that if you decide to change the swatch it won't be updated right away.

To force your swatches to update to the new image you've uploaded, you'll need to jump into the code briefly.

First, open up your theme code editor by navigating to Online store > Themes , and then click on the ellipse button and select Edit code.

Open these three files:

  • snippets/product-grid-item.liquid

  • snippets/variant-button.liquid

  • snippets/collection-sidebar-filters.liquid

You'll need to remove some code that needs to be done carefully, so it's best you back up the file first. If something goes wrong you can always follow these steps to revert the file.

Search and delete | split: '?' | first and you're all set.

In all three files the code should now look like this:

{%- assign color_image = value | handle | append: '.' | append: swatch_file_extension | asset_img_url: '50x' | prepend: 'https:' -%}

Was this article helpful?

Sorry about that! Care to tell us more?

Thanks for the feedback!

There was an issue submitting your feedback
Please check your connection and try again.