Skip to content

Instantly share code, notes, and snippets.

@finalwebsites
Created February 20, 2022 16:04
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 finalwebsites/a31735cb938c6c8babbe24b7139f499f to your computer and use it in GitHub Desktop.
Save finalwebsites/a31735cb938c6c8babbe24b7139f499f to your computer and use it in GitHub Desktop.
WooCommerce product variaties uitschakelen wanneer deze zijn uitverkocht
<?php
// plaats deze code in het functions.php bestand van je child thema
add_filter( 'woocommerce_variation_is_active', 'fws_disable_variations_out_of_stock', 10, 2 );
function fws_disable_variations_out_of_stock( $is_active, $variation ) {
if ( ! $variation->is_in_stock() ) return false;
return $is_active;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment