Shopify themes, liquid, logos, and UX
I know to create an add to cart link you would use https://domain.com/cart/add?id=VARIANT-ID-HERE that has been shared on this forum.
However, my products do not have variants. Is there a way to just add the product ID instead? When I use the product id it obviously tells me it's an invalid variant ID.
Or is the only way to do this is creating a variant for your product?
Did you get a solution to this?
simply add custom liquid block to the product page you wish to inquire and add the following code to show the variant id of the product shown
I did this and it worked perfectly. I have been trying to find a solution to this all day. Thank you!
Hi @xps15z and @AndrewPienaar1,
With Shopify every product is assigned a variant ID, even if you don't create any variants for your product. Confusing right?
Below is the easiest way to retrieve that elusive variant ID, so you can auto-add your product to the cart and simultaneously redirect users to the checkout page (Shopify calls this a cart permalink).
I hope that helps!
Hi @Brently , Thank you for this answer. I just tried it and I keep getting that the page cannot be found. Do you know if this is still working as of 07/13/23? I added .xml after the product number from within the Product Manager screen (in admin), but it does not load. Thanks for your help!
@Brently As it usually goes - I posted my question and then I figured it out. I decided to look at the product from the front of the site and I added .xml after the product name to reveal the details you mentioned above. I think I found my variant! Thanks again for your help. It was extremely useful.
Learn how to expand your operations internationally with Shopify Academy’s learning path...
By Shopify Feb 4, 2025Hey Community, happy February! Looking back to January, we kicked off the year with 8....
By JasonH Feb 3, 2025Expand into selling wholesale with Shopify Academy’s learning path, B2B on Shopify: Lau...
By Shopify Jan 28, 2025