Scroll to top

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 );

How to Hide WooCommerce Product Quantity Field from Product Pages || Hide WooCommerce Product Quantity Field || hide field in woocommerce.

In many cases,  Users are sell their products in one piece not in bulk like software, In this case this code will help you to hide quantity field on single page. Some time customers buy product in bulk by mistake. This code is helpful for those customers.

check for more information

Leave a Reply

Your email address will not be published.