我正在尝试使用 shopify_api gem 将产品添加到商店。这是我试图用来执行此操作的代码:
ShopifyAPI::Base.authenticate
variant_shopify = ShopifyAPI::Variant.create(
:compare_at_price => @variant.compare_at_price,
:created_at => @variant.created_at,
:fulfillment_service => @variant.product.vendor.fulfillment_service.name,
:grams => @variant.grams,
:id => @variant.id,
:inventory_management => @variant.inventory_management,
:inventory_policy => @variant.inventory_policy,
:inventory_quantity => @variant.inventory_quantity,
:price => @variant.price,
:requires_shipping => @variant.requires_shipping,
:sku => @variant.sku,
:taxable => @variant.taxable,
:title => @variant.title,
:updated_at => @variant.updated_at)
product_shopify = ShopifyAPI::Product.create(
:body_html => @product.body_html,
:created_at => @product.created_at,
:id => @product.id,
:images => [{ :src => @product.image.url }],
:product_type => @product.product_type,
:published_at => @product.published_at,
:template_suffix => @product.template_suffix,
:title => @product.title,
:updated_at => @product.updated_at,
:variant => variant_shopify,
:vendor => @product.vendor.business_name)
但是,此代码会导致来自 shopify 的 404 响应。关于我能做什么的任何想法?感谢您的帮助