Hi everyone,
I’m working on updating an old service at my company that syncs products with Shopify. The service is quite outdated, and I need to ensure that deprecated API calls don’t break our functionality. Here’s some context:
• Rails: 6.0.3
• Ruby: 2.7.4
• shopify-api-ruby: 9.5.1 → Upgraded to 13.4.0
• Shopify API version : 2023-07
• Currently using REST API, not GraphQL
After upgrading to shopify-api-ruby 13.4.0 (which is the highest version I can use with Ruby 2.7), many existing API calls broke due to changes in function signatures and response structures.
Issue 1: Product Metafields Returning nil
Previously, this code worked fine on 9.5.1:
# shopify-api-ruby 9.5.1
product = ShopifyAPI::Product.find(xxxxxxx)
pp product.metafields # Returns metafields correctly
However, after upgrading:
# shopify-api-ruby 13.4.0
product = ShopifyAPI::Product.find(id: xxxxxxx)
pp product.metafields # Returns nil
Why is this happening? Do I need to make an extra API call to fetch metafields separately?
Issue 2: Deprecation of Product Variant Fields
From the deprecation logs, Shopify is removing several product variant fields (e.g., sku, harmonizedSystemCode, inventoryManagement) in favor of using InventoryItem.
Proposed Temporary Solution
Instead of refactoring everything at once, would it be OK to stay on shopify-api-ruby 9.5.1 for now and just change how we retrieve product variant-related data?
For example, instead of accessing these fields from ProductVariant, we use InventoryItem:
ShopifyAPI::InventoryItem.find(variant.inventory_item_id)
This would allow us to avoid a full API migration all at once while still complying with Shopify’s deprecations.
Has anyone else faced a similar situation? Is this a valid approach, or should we move to GraphQL as soon as possible?
Thanks for any guidance!