0

i have the following problem. I want to import products to Shopify using the API. The body of the request should look like this:

{
"product": {
    "id": "100",
    "title": "Burton Custom Freestyle 151",
    "body_html": "<strong>Good snowboard!<\/strong>",
    "vendor": "Burton",
    "product_type": "Snowboard",
    "variants": [
    {
        "option1": "First",
        "price": "10.00",
        "sku": "1000"
    },
    {
        "option1": "Second",
        "price": "20.00",
        "sku": "1001"
    }
    ]
}
}
}

My CSV file now contains these values (of course the real one has a lot more values) example CSV

so every product should only contain one product id with the right variant id's. I don't have any clue how to loop through all rows and put them in the right format. The script should check if the product id is the same as in the row before and then add it as a variant to the product.

P.S: obviously i'm new to python and coding.

Thanks for any help in advance!

atom_29
  • 11
  • 2
  • **DO NOT use images** for textual data. Copy and paste the CSV data as text into your question. See here [Markdown help](https://stackoverflow.com/editing-help) *Tables* for how to do that as formatted table. – Adrian Klaver Jan 02 '23 at 22:27
  • Check out this link, It will definitely help you out. http://rest-examples.chilkat.io/shopify/python/chilkat_1.cshtml – Chinmay T Jan 24 '23 at 22:18

0 Answers0