Issue while creating product

I am currently working on integrating the Shopify API into our system to create products dynamically. However, I’ve encountered an issue when attempting to create products with multiple variants. Product is not creating with variants. Could you please provide guidance on how to achieve this using the Shopify API? I’ve thoroughly reviewed the documentation but haven’t found a clear solution.

i am using this payload

{ “file”: “https://cdn.pixabay.com/photo/2015/07/13/16/49/night-table-lamp-843461_1280.jpg”, “title”: “Manish Product111”, “SKU”: “Manish Product111”, “bar_code”: “Test bar code”, “weight”: 1, “dimensions”: “12*16”, “price”: 100, “cost_price”: 80, “wholesale_price”: 75, “variants”: [ { “option1”: “Red”, “price”: 10.00, “sku”: “red-variant-sku” } ] }

Hi @VaidbanV ,
This is Theodore from PageFly - Shopify Page Builder App.

Hi @Amandalman,
This is Theodore from PageFly - Shopify Page Builder App.

Instead of placing the variants array directly in the main payload, nest it within a “product” object. Include the image URL within an “image” object with an “src” key. The variants array itself can remain the same, containing details for each variant (option, price, SKU).

By making these adjustments and referring to the official Shopify API documentation for product creation with variants, you should be able to successfully create products with multiple variants through your system integration.

Best regards,
Theodore | PageFly

Best regards,
Theodore | PageFly