I follow the procedure below. It works when adding one variant but doesn't work for more than one ... any ideas why?
This is how I do it:
1- create an array called
my_variants=Array.new
2- in a loop I add variants to it:
variant=ShopifyAPI::Variant.new(
:option1 => "some option1",
:option2 => "some option2",
:sku => "AKJDKJ",
:position => 1,
:price => 10,
)
my_variants<<variant
OR
my_variants[i]=variant
3- add to product:
product = ShopifyAPI::Product.new(
:title =>"title1",
....
:variants => variants,
)
product.save