Count entries with condition
Assuming that your products are entries, and comments are related to a product through an entries field, you can use the following:

{% set comments = craft.entries.section('productcomments').relatedTo(entry).all() %}

This uses the relatedTo parameter.

You can then return how many comments are found by using:

{% if comments|length %}
    &lt;p&gt;{{ comments|length }} comments&lt;/p&gt;
{% endif %}