Hi Fernando,
This should do the trick for you…
function mytheme_show_product_variations(){
global $product;
if( is_user_logged_in() ) {
return;
}
else {
if( $product->is_type('variable') ) {
// Add the hook back in that was removed, when looking at Variations
add_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 30 );
// Remove price on Variation
remove_action( 'woocommerce_single_variation', 'woocommerce_single_variation', 10);
// Remove Add to Cart on Variation
remove_action( 'woocommerce_single_variation', 'woocommerce_single_variation_add_to_cart_button', 20 );
}
}
}
add_action( 'woocommerce_single_product_summary', 'mytheme_show_product_variations', 11 );
This will remove the Price and the Add to Cart button, but leave the Variations dropdown
Just to let you know, I’ve updated the plugin so that the Variation dropdowns will now display for Variable products so you wont need the above code any longer.