How can I find a product with variants using its id in Liquid?

I find product by id using this code:

{% assign productObj = collections.all.products | where: ‘id’, productId %}
However, it only helps find product that doesn’t have variant and be not a combination of other products. So how can I use id to get product that has variants or product that be a combination of other products?