Products Removed From Store But Color Swatches Still On Page

Products Removed From Store But Color Swatches Still On Page

Bobbybseo
Shopify Partner
6 0 0

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!

Replies 2 (2)

Small_Task_Help
Shopify Partner
965 38 93

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
    }
});
To Get Shopify Experts Help, Click Here or E-mail - hi@ecommercesmalltask.com
About Us - We are Shopify Expert India
At Google My Business - Ecommerce Small Task - Hire Shopify Developers Ahmedabad
Bobbybseo
Shopify Partner
6 0 0

Where would I add this java? in the product page template? Where?