Shopify themes, liquid, logos, and UX
Hi there -
I have product pages on my site that are showing EVERY color swatch I've EVER uploaded for a specific product variant on the product page, despite these products being deleted or archived and removed from the shop in Shopify's settings.
https://evolvefitwear.com/products/bhakti-pant-14
Example: the shadow tie-die colorway, the pink 'raspberry' colorway', there's also a white box of 'javascript; void(0);' that I can't figure out how to remove, etc.
These out of stock/no longer carrying products need to be removed from the page, but I can't figure out how to remove them. Please advise!
Hi,
Hope this will help
- Clear Cached Data
- Delete the code for Hardcoded Swatches if there
- If you are using Swatch App then disable it.
- Remove Ghost Swatches Using JavaScript
Javascript code example
document.querySelectorAll('.color-swatch').forEach(swatch => {
if (!swatch.dataset.color || swatch.dataset.color.includes("javascript:void(0)")) {
swatch.remove(); // Remove ghost swatches
}
});
Where would I add this java? in the product page template? Where?
Hey Community 👋 Did you know that March 15th is National Everything You Think Is W...
By JasonH Apr 1, 2025Discover how to increase the efficiency of commerce operations with Shopify Academy's l...
By Jacqui Mar 26, 2025Shopify and our financial partners regularly review and update verification requiremen...
By Jacqui Mar 14, 2025