Skip to content

Instantly share code, notes, and snippets.

@andycole
Created September 26, 2017 09:10
Show Gist options
  • Save andycole/83d1b173ba380236a65caedc45eeffb9 to your computer and use it in GitHub Desktop.
Save andycole/83d1b173ba380236a65caedc45eeffb9 to your computer and use it in GitHub Desktop.
Code workarounds
<!-- Hide particular product in items to match on PDP -->
<!-- Inserted into Product description of master product -->
<script>
defer(function($){
function hideSuspenders() {
var _sspndr = $('a:contains("Sexy Lace Suspender Belt")').closest('li')
var _sspndr2 = $('a:contains("Standalone Suspender Belt")').closest('li')
if ($('.product-top-content .color-swatch.black.selected').length) {
_sspndr.hide()
_sspndr2.show()
} else {
_sspndr.show()
_sspndr2.hide()
}
}
hideSuspenders();
$(document).ajaxComplete(function(e, x, o) {if (o.url.indexOf('Product-Variation') >= 0 ) {hideSuspenders();}});
})
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment