Skip to content

"inventory_quantity"=>"expected String to be a Integer"} on variant.save #969

@jacksonSingleton

Description

@jacksonSingleton

Issue summary

Write a short description of the issue here ↓
When calling save on a product variant, it returns the error 'request': {"inventory_quantity"=>"expected String to be a Integer"} (ShopifyAPI::Errors::HttpResponseError) despite not modifying inventory quantity at all.

Here's my code block that the error is tracing to

def modify_inventory_management(item)
  puts item.inspect
  item.fulfillment_service = 'manual'
  item.inventory_management = 'shopify'
  item.save
end

Expected behavior

What do you think should happen?
So my code was previously working before upgrading to v10.x from gem version 9.5.1. I would assume it would just write and give a 200 status

Actual behavior

What actually happens?

Details `'request': {"inventory_quantity"=>"expected String to be a Integer"} (ShopifyAPI::Errors::HttpResponseError)`

Steps to reproduce the problem

  1. Just calling product.variant[0].save is producing the problem even without modifying any fields

Logs

If applicable, enable the logs as described in the README, and paste the relevant portion here.

So here's the output of product.variant.first.inspect where on option1 the inventory_quantity field is correctly set to 0 rather than a string as described in an error

Details#42522703003872, :product_id=>7583295275232, :title=>"Default Title", :price=>"431.96", :sku=>"", :position=>1, :inventory_policy=>"deny", :compare_at_price=>"479.95", :fulfillment_service=>"manual", :inventory_management=>"shopify", :option1=>"Default Title", :option2=>nil, :option3=>nil, :created_at=>"2022-03-09T15:40:35-06:00", :updated_at=>"2022-05-24T12:20:53-05:00", :taxable=>false, :barcode=>"", :grams=>0, :image_id=>nil, :weight=>0.0, :weight_unit=>"lb", :inventory_item_id=>44617021161696, :inventory_quantity=>0, :old_inventory_quantity=>0, :requires_shipping=>true, :admin_graphql_api_id=>"gid://shopify/ProductVariant/42522703003872"}, @custom_prefix=nil, @forced_nils={"id"=>false, "product_id"=>false, "title"=>false, "price"=>false, "sku"=>false, "position"=>false, "inventory_policy"=>false, "compare_at_price"=>false, "fulfillment_service"=>false, "inventory_management"=>false, "option1"=>false, "option2"=>true, "option3"=>true, "created_at"=>false, "updated_at"=>false, "taxable"=>false, "barcode"=>false, "grams"=>false, "image_id"=>true, "weight"=>false, "weight_unit"=>false, "inventory_item_id"=>false, "inventory_quantity"=>false, "old_inventory_quantity"=>false, "requires_shipping"=>false, "admin_graphql_api_id"=>false}, @aliased_properties={}, @session=#, @expanded_scopes=#>, @associated_user_scope=nil, @expires=nil, @associated_user=nil, @is_online=true, @shopify_session_id=nil>, @client=#"Shopify API Library v10.1.0 | Ruby 3.0.3", :Accept=>"application/json", "X-Shopify-Access-Token"=>"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"}>, @errors=#, @barcode="", @compare_at_price="479.95", @created_at="2022-03-09T15:40:35-06:00", @fulfillment_service="manual", @grams=0, @id=42522703003872, @image_id=nil, @inventory_item_id=44617021161696, @inventory_management="shopify", @inventory_policy="deny", @inventory_quantity=0, @inventory_quantity_adjustment=nil, @old_inventory_quantity=0, @option=nil, @position=1, @presentment_prices=nil, @price="431.96", @product_id=7583295275232, @requires_shipping=true, @sku="", @tax_code=nil, @Taxable=false, @title="Default Title", @updated_at="2022-05-24T12:20:53-05:00", @weight=0.0, @weight_unit="lb", @Option1="Default Title", @option2=nil, @option3=nil, @admin_graphql_api_id="gid://shopify/ProductVariant/42522703003872">

Specifications

  • shopify_api version: v10.1.0
  • Shopify API version used: Attempted with both 2022-01 and 2022-04

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions