Commerce: How can I check that a user has bought a product? I have a digital product, with a landing page, and I want to know if the connected user has already bought the product so I can give him access to the content.
There is a direct way to find this out.
Here's an example.  Note the id you supply must be the specific purchasableId, not the product id (so the defaultVariant.id or variant.id).
{# Has the customer explicitly bought the XXX product? Returns 0 (==false) or &gt;= 1 (==true) #}

{% set purchasedXXX = craft.orders()
    .user(currentUser)
    .hasPurchasables(10637)
    .isCompleted()
    .count()
%}

You can then use that as just
{% if purchasedXXX %}
 ...
{% endif %}