When you have a page like domain.com/products/product_name?variant=variant_id
This means that the page that is being loaded is the variant of the specific product (product_name) here since there's the url query "variant".
Like for example, 1 tshirt has many variant colors, so the same design can have different variant pages (this is just a simple example) I want to check if the current page is a variant of a product or not before it loads through liquid. How?
You can use product.selected_variant
that will return the variant ID if the get parameter is present or not.
Based on that you will be able to write a simple if:
{%- if product.selected_variant -%}
{%- else -%}
{%- endif -%}