FROM CACHE - en_header

Product Variants

Shopify Partner
2 0 0

Hello, I'm trying to create a private app that uploads new products to my shopify site.

I have it working to upload the product but I am super confused about the variants.

I need a variant with options for Bottle Size and Strength 

IE: "0mg","3mg","6mg" and "30ML","30ML","30ML"

My Product looks like this 

    shopify = {
        "product": {
            "title": post['title'],
            "body_html": "",
            "price": post['price'],
            "vendor": post['brand'],
            "product_type": "XXXX",
            "published": False,
            "variants": [],

            "options": [],
            "images": [{ "src": post['images'][0]['url'] }]

how do I add the options value for a variant? 

Reply 1 (1)
Shopify Partner
2 0 0

okay, i figured it out. This link below helped alot!

The issue is that option is the name and the variant is the value for the option. 

option1 in variant is the option in position one.

"options": [
                    "name": "BOTTLE SIZE",
                    "position": 1
                    "name": "Strength",
                    "position": 2

{ variants: { "option1": XXX, "option2": XXX, "price": XXX  } }