how can I create product without variants using api

kinza
Tourist
6 1 1

how to create or modify product without variants, to be specific, how to add or modify price, quantity etc for product without variants. the above format is a guess from what is returned from the GET method.

Can someone please help me out?

0 Likes
Alex
Shopify Staff
Shopify Staff
1555 81 295

All products technically have variants. If you create a product without specifying any variants, there's a someone hidden one created called default title.

 

With this logic, you could create a product with seemingly no variants like so:

 

POST https://domain.myshopify.com/admin/products.json

{
	"product": {
		"title": "Foobar",
		"variants": [
			{
				"title": "Default Title",
				"price": "25.00",
				"option1": "Default Title"
			}
		]
	}
}

Hope that helps.

cmuench
Tourist
5 0 1

There is a bug with this in API 2021-01. If you 1st create a product that has more than 1 variant and then try to save a product with just the default variant  you can never get the default variant to go away in Shopify UI. It always has 1 variant even though there aren't any anymore

0 Likes