Each product is assigned a specific ID that appears in the URL bar. Disabling the history state feature simplifies the URL by hiding the product and variant IDs, leaving only the main product link.
How to Remove the Variant URL?
STEP 1
Access your Shopify Admin's Theme Library to open the theme customizer.
STEP 2
Click on the Theme Settings icon, and go to Advanced Settings.
STEP 3
Scroll to Product Grid and untick Enable history state to remove the URL.
STEP 4
Click Save to apply changes.