Solved

Is it possible to create product with a price via the REST API wit a single request?

layerok
Visitor
3 1 0

I can't find any information how to create a product with a price for a default variant via the REST API with a single request. I only know how to do this with two requests. First create a product and then update a price of the default variant. So I want to know if it is even possible to do this with a single request?

Accepted Solution (1)

layerok
Visitor
3 1 0

This is an accepted solution.

Forget it, I figured it out myself.
Just provide an array of variants in the request body when creating a product as shown below

'variants' => [['price' => 22.00]],

 

View solution in original post

Replies 2 (2)

layerok
Visitor
3 1 0

This is an accepted solution.

Forget it, I figured it out myself.
Just provide an array of variants in the request body when creating a product as shown below

'variants' => [['price' => 22.00]],

 

dimitrisgoudis
Shopify Partner
1 0 0

Hey @layerok,

In that way we have to create parent products with no price details and on each parent product we have to assign the at least one variant product, is that right? 

Is this also the most efficient way to structure product details? 

Thanks

Yours sincerely,

Dimitris Goudis