2014-01-08 35 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> 
]