2014-01-08 39 views

回答

0

你差点。您忘记实际提供资源的ID。就你而言,因为你正在寻找分配给产品的元字段的所有值,所以你需要提供产品ID。

ShopifyAPI::Metafield.all(params: {resource: 'products', resource_id: 149523945, fields: 'value'}) 
=> [ 
    #<ShopifyAPI::Metafield:0x007f80041f3958 @attributes={"value"=>"4999"}, @prefix_options={:resource=>"products", :resource_id=>149523945}, @persisted=true>, 
    #<ShopifyAPI::Metafield:0x007f80041f36b0 @attributes={"value"=>"Céà"}, @prefix_options={:resource=>"products", :resource_id=>149523945}, @persisted=true>, 
    #<ShopifyAPI::Metafield:0x007f80041f3408 @attributes={"value"=>"Cíao"}, @prefix_options={:resource=>"products", :resource_id=>149523945}, @persisted=true>, 
    #<ShopifyAPI::Metafield:0x007f80041f3160 @attributes={"value"=>"1"}, @prefix_options={:resource=>"products", :resource_id=>149523945}, @persisted=true> 
]