Skip to content

Instantly share code, notes, and snippets.

@plugin-republic
Last active December 2, 2021 13:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save plugin-republic/3a4ae9c4454a177f6dd8ed9267ece034 to your computer and use it in GitHub Desktop.
Save plugin-republic/3a4ae9c4454a177f6dd8ed9267ece034 to your computer and use it in GitHub Desktop.
<?php
/**
* Enable/disable the grid for specific product IDs
*/
function prefix_enable_variations_grid( $enable, $product_id ) {
// Only enable these products
if( in_array( $product_id, array( 123, 456, 789 ) ) ) {
return true;
}
// Don't enable these products
if( in_array( $product_id, array( 987, 654, 321 ) ) ) {
return false;
}
return $enable;
}
apply_filters( 'wcbvp_enable_variations_grid', 'prefix_enable_variations_grid', 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment