Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong type for InventoryItem's harmonized_system_code #1256

Closed
weizheheng opened this issue Dec 14, 2023 · 2 comments
Closed

Wrong type for InventoryItem's harmonized_system_code #1256

weizheheng opened this issue Dec 14, 2023 · 2 comments

Comments

@weizheheng
Copy link

Issue summary

This gem declare the harmonized_system_code as T.nilable(Integer), however, when I try to add the HS code using Shopify dashboard, it seems to be saved in String instead of Integer.

This raises type error when I try to get the hs code using using inventory_item.hs_code

CleanShot 2023-12-14 at 12 19 31@2x

For now I have to monkey patched it in order to retrieve the hs code

def harmonized_system_code
  value = get_property("harmonized_system_code")

  return value if value.nil?

  value.to_s
end

So, I am wondering what is the correct type for harmonized_system_code? If it's a String, I am happy to open a PR to change the type declaration.

  • shopify_api version: 13.3.1
  • Ruby version: 3.0.6
  • Operating system: MacOS Ventura 13.2.1

Expected behavior

I am not sure if it's intended to be an Integer or it's a wrong type in the first place. But if the harmonized system code is indeed supposed to be an Integer, then I am expecting the harmonized system code should be saved as Integer.

Actual behavior

The harmonized system code is saved as String.

Steps to reproduce the problem

  1. Create a new product with default variant on Shopify dashboard and set the HS Code
  2. Get the inventory_item record using this gem
product = ShopifyAPI::Product.find(id: the_product_id)
inventory_item_id = product.variants.last.inventory_item_id
inventory_item = ShopifyAPI::InventoryItem.find(id: inventory_item_id)
  1. Try calling inventory_item.harmonized_system_code, the type error like below should be raised
CleanShot 2023-12-14 at 12 19 31@2x
@weizheheng
Copy link
Author

related issue #1087

@lizkenyon
Copy link
Contributor

Hi 👋

Please see this comment on this PR for our plan for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants