Skip to content

Instantly share code, notes, and snippets.

@Cleanse
Last active March 10, 2019 22:54
Show Gist options
  • Save Cleanse/129ea96a0f0622a00099d71d86028709 to your computer and use it in GitHub Desktop.
Save Cleanse/129ea96a0f0622a00099d71d86028709 to your computer and use it in GitHub Desktop.
Created Retired tag, hide sold-out products, except on Retired category page.
window.onload = function () {
var divsToHide = document.getElementsByClassName("ProductList-item sold-out");
for(var i = 0; i < divsToHide.length; i++){
if(window.location.href.indexOf("Retired") > -1) {
return;
}
divsToHide[i].style.visibility = "hidden";
divsToHide[i].style.display = "none";
}
var divsToHideWrapper = document.getElementsByClassName("ProductList-grid clear");
for (var x = 0; x < divsToHideWrapper.length; x++) {
divsToHideWrapper[x].style.display = "flex";
divsToHideWrapper[x].style.flexWrap = "wrap";
}
}
@Cleanse
Copy link
Author

Cleanse commented Mar 10, 2019

Updated with flexbox to fix the 'float' + :nth-child(3n+1) + :nth-child(2n+1) css the default theme uses.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment