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?
Learn how to build powerful custom workflows in Shopify Flow with expert guidance from ...
By Jacqui May 7, 2025Did You Know? May is named after Maia, the Roman goddess of growth and flourishing! ...
By JasonH May 2, 2025Discover opportunities to improve SEO with new guidance available from Shopify’s growth...
By Jacqui May 1, 2025