16 January 2020

How to Hide WooCommerce Product Quantity Field from Product Pages?

Hide WooCommerce Product Quantity Field from Product Pages


www.wpcodekit.com


function quantity_wp_head() {
 
if ( is_product() ) {
    ?>
<style type="text/css">.quantity, .buttons_added { width:0; height:0; display: none; visibility: hidden; }</style>
<?php
    }
}
    add_action( 'wp_head', 'quantity_wp_head' );


Or



add_filter( 'woocommerce_is_sold_individually', 'cw_remove_quantity_fields');
function cw_remove_quantity_fields( $return, $product ) {
switch ( $product->product_type ) :
case "grouped":
return true;
break;
case "external":
return true;
break;
case "variable":
return true;
break;
default:
return true;
break;
endswitch;
}




Or




function cw_remove_quantity_fields( $return, $product ) {
    return true;
}
add_filter( 'woocommerce_is_sold_individually', 'cw_remove_quantity_fields', 10, 2 );




How to Hide WooCommerce Product Quantity Field from Product Pagesd_individually', 'cw_remove_quantity_fields', 10, 2 );

No comments:

Post a Comment

How to add re-captcha v3 on all Elementor forms using coding?

 Add re-captcha v3 on all Elementor forms using coding add_action('wp_footer',function(){     ?> <script src="https://www...