I have successfully added color swatches to our Motion Theme Shopify store but one color image is not working.
I already added it to the asset folder, and files but it keeps appearing as the color brown on the swatch button (the brown one was my previous image swatch uploaded in Files.
Though I’ve already deleted it, it still appearing, and when I deleted the new image swatch I uploaded, it became white as default. (Then add the new image swatch but will appear as brown again.)
I wonder why?
I don’t like to code and make scripts as it’s longer.
I hope someone can help me. Thanks in advance!
Hi @jgelicame
First, open up your theme code editor by navigating to /admin/themes, clicking Actions on your copy of your theme, and then 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:' -%}
If helpful then please Like and Accept Solution.
Want to modify or custom changes on store Hire me.
Right. I found this solution on the web too and this is done already. It worked and forgot to come back here to make an update.