This function is only available when the product has variants such as color, size, (depends on product type).
Update history state for product deeplinking shopify. It’s possible to create a deep-link directly to a specific variant by adding a query string to a product page URL. You can achieve this by appending the ?variant= query parameter to the URL of the product, along with the ID of the variant.
Please follow the instruction below