Creating direct link to product URL from variant/product ID

Creating direct link to product URL from variant/product ID

vapecommerceuk
Excursionist
26 0 6

I would like to create a direct link to the live product on my Shopify store which will be created from the variant or product ID. This can be done through the API or URL redirect? 

 

The variant/product ID is the only variable I have to work with, is this possible?

 

Thank you

Vaping and working
Replies 5 (5)

ranjan-purbey
Shopify Partner
11 1 5

You can use

https://<shopify_domain>/variants/<variant_id> for product detail page

or

https://<shopify_domain>/cart/<variant_id>:<quantity>?storefront=true for adding the product to the cart and showing the cart page

Kitajc
Visitor
2 0 1

I have exactly the same question, but for the products without variants. Is it possible to access products without variants via URL containing just product id number? 

ranjan-purbey
Shopify Partner
11 1 5

I am not aware of such an option. But shopify creates a default variant for products where you have not explicitly created a variant. You can use that variant's ID for generating the link.

Kitajc
Visitor
2 0 1

Where can I get this number of default variant for products without variants?

ranjan-purbey
Shopify Partner
11 1 5

You can either use the Admin API or login to admin dashboard of your store and go to https://admin.shopify.com/store/<STORE_SLUG>/products/<PRODUCT_ID>.json