Shopify App to manage the combo products. We were creating a single product by adding multiple products to that single combo product and manages the inventory when any combo product or individual product from that combo purchased by any user from any location of inventory.
We were using ShopifyAPI calls for performing create products and manage them, as ShopifyAPI has some limit to make API calls, it’s 40 requests per 2 seconds and we were making frequent requests for managing resources. And this API call limit was a headache to achieve concurrent results.
Solution Implementation
def fetch_products
product_query(combo_product_id)
client.query(ProductQuery)
end
def product_query(id) query = <<-GRAPHQL
{
nodes(ids: #{id}) {
... on Product {
variants(first: 1){
edges{
node{
id
inventoryItem {
id
}
}
}
}
}
metafields(first: 10){
edges{
node{
key
value
}
}
}
}
}
GRAPHQL
Kernel.const_set(:ProductQuery, client.parse(query))
end
For finding client
def client
ShopifyAPI::GraphQL.new
end
We are open for new challenges and we help you reach your goals!