I'm using the below code to make all products on woocommerce not purchasable unless the user is signed in.
function et_remove_atc(){
if( ! is_user_logged_in() ){
return false;
}else{
return true;
}
}
add_filter( 'woocommerce_is_purchasable', 'et_remove_atc' );
This only works for simple products and not variable products. I've tried to add the below additional filter, but this doesn't work.
add_filter( 'woocommerce_variation_is_purchasable', 'et_remove_atc', 10, 2 );
What am I missing?