Os explico 2 maneras de ocultar el campo de cantidad en los productos variables de WooCommerce.
function quantity_wp_head() {
global $post;
global $product;
$product = wc_get_product( $post->ID );
// $product->is_type( $type ) checks the product type, string/array $type ( 'simple', 'grouped', 'variable', 'external' ), returns boolean
if ( $product->is_type( 'variable' ) ) {
?>
<style type="text/css">.quantity, .buttons_added { width:0; height:0; display: none; visibility: hidden; }</style>
<?php
}
}
// add_action( 'wp_head', 'quantity_wp_head' );
/**
* @desc Remove in all product type
*/
function wc_remove_all_quantity_fields( $return, $product ) {
if ($product->is_type('variation')) {
return true;
}
return $return;
}
add_filter( 'woocommerce_is_sold_individually', 'wc_remove_all_quantity_fields', 10, 2 );