Add multiple varient options in shopify product

R0SENAM

I am trying to add multiple options like size/color/type in the product but no matter whatever i do i am only able to add 1 option, if i add more than one, i get just a flag with status "False" and no other error. I am using shopify api.

Try 1:

new_product.options = [{"name" : "Color", "values": ['p', 'k', 'l'], "position": 1}]
new_product.options = [{"name" : "Size", "values": ['p', 'k', 'l'], "position": 2}]
new_product.options = [{"name" : "Type", "values": ['p', 'k', 'l'], "position": 3}]

With this method only the last one will be added, which means that the next statement replaces previous one even when i gave the position. Also when Type is added in the product, the values also are not added in product and "Default Title" is shown.

Try 1:

 new_product.options = [{"name" : "Color"}, {"name" : "Size"}, {"name" : "Type"}]

Again only 1 was added in product.

Try 2:

opt1 = shopify.Option()
opt1.name = "Color"
opt2 = shopify.Option()
opt2.name = "Size"
opt3 = shopify.Option()
opt3.name = "Type"

#This works, no matter which one i add.
new_product.options = [opt1]

#This does not.
new_product.options = [opt1, opt2, opt3]
R0SENAM
new_product.options = [{"name": "Color"}, {"name": "Size"}, {"name": "Type"}]
new_product.variants = shopify.Variant(dict(price=float(price.replace("$", "")), inventory_management="shopify", inventory_quantity=100, option1="Red", option2="36", option3="Type"))

Problem was solved, the issue was not that Other options were not added. The actual issue was that Shopify did not allow more than one empty options. So it was required that i add the values as well.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Shopify Multiple Product options, add event to generated dropdown options

Shopify send product with options on shopify

Shopify more then 3 Product options

How to update product options in product variant in Shopify?

Add product in cart by using Shopify

Shopify: More than 3 Product Options

Add product with array of options to cart

Cannot get value of textarea with Shopify Product Options by Bold

Add to cart ajax custom product type options

Add checkbox to WooCommerce product advanced options tab

How can I add product to shopify store from another website?

Can a Shopify Public App extend the "Add/Edit Product" page?

How can i add Order Estimator to Shopify product details page

How to add a credit card logo in the product page of a Shopify site

In Shopify add a product via SKU rather than Variant ID

How to add "you added this" bellow the product in the collection SHOPIFY

Shopify - Add Number (1,2,3) before Product in Collection

Shopify liquid, add multiple products to cart

Is Multiple APK and Build varient feature of Android same

Prestashop - Add multiple categories to a product

add options to select - multiple selects

How to bundle product in shopify?

Shopify - Free Product with Purchase

How to add an add to cart button on products displayed on product recommendation section in shopify?

Magento 2 add product to cart programmatically with custom options

Bigcommerce Stencil / Sticky add to cart button not registering product options

Azure Devops Pipeline cross product of multiple matrix options

How to separate Li items when selecting multiple options in a variable product?

Add multiple records to database on product purchase