add_filter( 'woocommerce_quantity_input_max', 'woo_sell_service_test_quantity_input_max', 20 ,2 ); function woo_sell_service_test_quantity_input_max( $max_value, $product ) { if ( 'yes' == get_post_meta( $product->get_id(), '_wss_type', true ) ){ update_post_meta( $product->get_id(), '_sold_individually', '' ); } return $max_value; }