Ich kann nicht scheinen, ein Produkt mit mehreren Optionen zu erstellen. Ich habe alles ausprobiert und die Dokumentation aus der offiziellen Bibliothek von Shopify ist schlecht. Ich habe den gesamten API-Referenzhandbuch durchsucht und nach anderen Formularen gesucht, kann jedoch nicht die richtige Syntax finden. Code ist unten. Ich versuche, ein Produkt mit zwei Optionen zu erstellen, z. B. Option1 ist die Größe und Option2 ist die Farbe. Es werden auch keine Fehlermeldungen für die Druckausgabe angezeigt, aber Variantenoptionen erscheinen nicht im Shopify Store, nur das Produkt mit 0 Varianten erscheint.Shopify Python API Variantenoptionen Nicht in den Store schreiben
new_product = shopify.Product()
new_product.title = "My Product"
new_product.handle = "test-product"
##what I've tried... and countless others
#First example of new_product.variants
new_product.variants = shopify.Variant({'options': {'option1' : ['S', 'M', 'L', 'XL'], 'option2' : ['Black', 'Blue', 'Green', 'Red']}, 'product_id': '123456789'})
#Second example of new_product.variants
new_product.variants = shopify.Variant({'options': [{'option1': 'Size', 'option2': 'Colour','option3': 'Material'}]})
#Thrid example of new_product.variants
new_product.variants = shopify.Variant([
{'title':'v1', 'option1': 'Red', 'option2': 'M'},
{'title':'v2', 'option1' :'Blue', 'option2' :'L'}
])
new_product.save()
##No errors are output, but doesn't create variants with options
if new_product.errors:
print new_product.errors.full_messages()
print "Done"