【问题标题】:Rails Gem Shopify_app not able to save new products to shopRails Gem Shopify_app 无法将新产品保存到商店
【发布时间】:2015-09-15 01:53:08
【问题描述】:

使用 Shopify API 和应用程序 gem,我创建了一个有效会话并激活了它,但由于某种原因,我无法将新产品保存到连接的 Shopify 商店。见下面的代码

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 = "Test-Product"new_product.save 为我工作,并且确实创建了产品。

标签: ruby-on-rails ruby shopify


【解决方案1】:

我希望你能告诉我们你到底得到了什么错误,还请检查你的范围,它是否包括“write_products”?

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-11-03
    • 2021-01-04
    • 2017-10-09
    • 1970-01-01
    • 1970-01-01
    • 2021-11-15
    • 1970-01-01
    相关资源
    最近更新 更多