0
使用Shopify API和应用宝石我创建了有效会话并将其激活,但出于某种原因,我无法将新产品保存到所连接的Shopify商店。请参见下面的Rails Gem Shopify_app无法将新产品保存到商店
session = ShopifyAPI::Session.new(shop,token)
if session.valid?
ShopifyAPI::Base.activate_session(session)
sellersku.each do |xyz|
yours = find_by sellersku: xyz
new_product = ShopifyAPI::Product.new
new_product.title = yours.title
new_product.product_type = yours.product_type
new_product.vendor = yours.vendor
new_product.body_html = yours.description
new_product.images = yours.image
new_product.save
end
如果会话有效,就像您说的,这可能会失败的唯一原因是由于标题为空。你确定你所有的参数都存在并且有效吗?我只是测试了一下。 'new_product.title =“测试产品”和“new_product.save”为我工作,产品确实创建。 – voskart