添加产品变体的正确方法是什么?
我成功地创建了产品,它显示在我的Shopify管理员中。然而,价格始终为零,数量始终为无穷大。
我已经尝试使用inventory_quantity和价格集以及prefix_options中的product_id集创建了一个变体。
然而,管理员总是显示价格为零,数量为无穷大。
Rails v3.2.5
shopify_api v3.0.0
shop name: vacation-2在执行API调用时,我没有遇到错误。我只是在admin的产品中看不到我的变体数据。
发布于 2012-06-12 07:40:49
确保将:inventory_management属性设置为"shopify",否则数量将不会持久。
我刚刚测试了一下,它工作得很好:
product.variants << ShopifyAPI::Variant.new(
:option1 => "Large",
:price => 12.95,
:inventory_management => 'shopify',
:inventory_quantity => 10
)
product.save发布于 2018-06-21 04:28:07
不使用products关联添加变体:
ShopifyAPI::Variant.new(
:product_id => #enter product id,
:option1 => "Large",
:price => 12.95,
:inventory_management => 'shopify',
:inventory_quantity => 10
)
product.save这里的优点是使用API返回的值来更新variant对象。
https://stackoverflow.com/questions/10984602
复制相似问题