Sunday, January 23rd, 2022

How to remove quantity field from WooCommerce product page

By default, WooCommerce displays the quantity selector on a product’s page. This may not always be desired, so here are the ways you disable this feature.

Method 1: Using Options in the Product Data Metabox

This meta box is found on the wp-admin page to edit that particular product. Scroll to the bottom of the editor and you’ll find the Product data metabox and the setting under Inventory.

Method 2: Using Hooks or Filters

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

You can include this code in your theme’s functions.php file or in a custom plugin if you wish.

default image

editorial staff

Editorial staff at Tutsflow.

Source link