Skip to content

Instantly share code, notes, and snippets.

@andreiglingeanu
Last active December 20, 2023 14:46
Show Gist options
  • Save andreiglingeanu/dec19ed869edc75905901ed3d9cb7d29 to your computer and use it in GitHub Desktop.
Save andreiglingeanu/dec19ed869edc75905901ed3d9cb7d29 to your computer and use it in GitHub Desktop.
<?php
add_filter(
'blocksy:pro:woocommerce-extra:swatches:has-single-product-swatches',
function ($has_single_product_swatches) {
global $product;
if (has_term(array('sneakers'), 'product_cat', $product->get_id())) {
return false;
}
$products_without_swatches = [
// list all product IDs that should not have swatches
105,
106
];
if (in_array($product->get_id(), $products_without_swatches)) {
return false;
}
return $has_single_product_swatches;
}
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment