in

WooCommerce Hide Quantity Input Field From Product Page

WooCommerce is good plugin for selling products online it comes
with lots of customization and options you can sell any kind ofproduct with it digital products as well some times we provide thatcustomer buy only one item at time or there is not need for Item Quantity Field and you realize later after adding lots of products. Now there is a filter you can apply using theme function file and the field will hide.Hide Quantity Field from All Product Types You can use below code paste it into function.php file of your theme and save.

woocommerce_input_field-300x281Want Best WooCommerce themes Click here

Mothod 1: Hide From all product type

/**@ Remove in all product type*/
function baztro_remove_all_quantity_fields( $return, $product ) {
return true;
}
add_filter( 'woocommerce_is_sold_individually', 'baztro_remove_all_quantity_fields', 10, 2 );

 

Method 2 If You want to hide from particular type of product

/**
* @Hide from different product type group
*/
add_filter( 'woocommerce_is_sold_individually', 'baztro_wc_remove_all_quantity_fields', 10, 2 );
function baztro_wc_remove_all_quantity_fields( $return, $product ) {
switch ( $product->product_type ) :
case "variable":
return true;
break;
case "grouped":
return true;
break;
case "external":
return true;
break;
default: // simple product type
return true;
break;
endswitch;
}

Method 3 Hide WooCommerce Input Field using CSS

Method 4: Using Option Sold Individually in Edit Product Page

  • Choose product where you don’t wish to show quantity field
  • Edit Product
  • From Bottom Click Inventory
  • Check the box Sold Individually
  • Update Product
woocommerce Sold Individually
Check Sold Individually

These are some code that definitely work for you if any problem please discuss in below in comment.

3 Comments

Leave a Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

Aircel Offer For 1GB Free Internet With Voice Facility

google-norecapthca-example

Integrate Google No reCAPTCHA into Website Form