please help me Create product with price without variant ????? using API

Solved
Highlighted
Tourist
6 1 1

Hi
I have created an application to Create  product via API ->  "/admin/products.json"
Everything is perfect but the price of the product does not enter


Also when I create a variant ->  "/admin/products/".$productID."/variants.json" tttttt.JPG

it is added successfully but it enters another default variant without options & price what can I do ??
I just want to know what the solution is please help me

1 Like
Highlighted
Shopify Partner
1840 177 709

This is an accepted solution.

A product without options / variants still has a default variant which is what you're seeing. The product itself is just a parent object with common attributes while the product variants are the actual product item i.e. also what you see being added to a cart, order lines, linked to inventory item etc.

 

So regardless whether you create a new product via UI or API, if you do not provide options / variants explicitly, the default variant is created. If you wish to add just one variant later and do not want any others i.e. the default, I suggest you update the default variant instead of adding a new variant.

Liked this post? You might also like our fantastic upsell apps Candy Rack and Candy Cart or offer free gifts with Gift Box. All made with ❤️  and care by Digismoothie
1 Like
Highlighted
Tourist
6 1 1

This is an accepted solution.

how stupid I am =) 

thank you very much

This was done successfully

Thank you from the heart 

0 Likes
Highlighted
Shopify Partner
1840 177 709

This is an accepted solution.

No worries. The API covers a lot in itself on top of all Shopify concepts - easy to skip a beat or miss something now and then. Glad you got it figured out now.

Liked this post? You might also like our fantastic upsell apps Candy Rack and Candy Cart or offer free gifts with Gift Box. All made with ❤️  and care by Digismoothie
1 Like
Highlighted
New Member
1 0 0

Hi:

Additional Question:

How do I update a product with default variant using the REST-API?

I created the product without passing option values.

in the Shopify Admin area the product seems to lack a variant (that's OK for me).

But  when updating it again using the REST API, I usually have to pass the Shopify-Variant-ID.

This fails. When reading the product with the REST-API, there is no variant.

So: how can I update a product without variant???

Thanks a lot!

Kai

0 Likes