Shopify / shopify-api-ruby

ShopifyAPI is a lightweight gem for accessing the Shopify admin REST and GraphQL web services.
MIT License
1.06k stars 471 forks source link

ShopifyAPI::Product is not returning `inventory_quantity` inside `variants` #1267

Closed richardm0228 closed 9 months ago

richardm0228 commented 9 months ago

Issue summary

I'm using ShopifyAPI::Product.all and ShopifyAPI::Product.find to read products from my store, but it is not returning inventory_quantity value inside variants.

// Paste any relevant logs here
// Here's the variants value from ShopifyAPI
  "variants": [
    {
      "barcode": "",
      "compare_at_price": "499.00",
      "created_at": "2023-12-19T12:37:44-05:00",
      "fulfillment_service": "manual",
      "grams": 0,
      "id": 40762607075417,
      "image_id": null,
      "inventory_item_id": 42856043511897,
      "inventory_management": "shopify",
      "inventory_policy": "deny",
      "old_inventory_quantity": 100,
      "position": 2,
      "price": "499.00",
      "product_id": 7462470221913,
      "requires_shipping": true,
      "sku": "100",
      "taxable": true,
      "title": "Default Title",
      "updated_at": "2023-12-19T14:07:02-05:00",
      "weight": 0.0,
      "weight_unit": "lb",
      "option1": "Default Title",
      "option2": null,
      "option3": null,
      "admin_graphql_api_id": "gid://shopify/ProductVariant/40762607075417"
    }
  ],

Expected behavior

I want to receive correct variants value with inventory quantity.

Actual behavior

It is returning wrong variants value - without inventory quantity.

richardm0228 commented 9 months ago

I close this ticket since I get products details from shopify api url directly instead of using ShopifyAPI::Product.all