Warehouse Product Update

Hello there!

It’s me again. To put you in context, in our system we manage only one price for each product, in all of the warehouses. Now we are implementing CRUD operations of our products that have to be integrated with Shiphero.

But in Shiphero, the prices are stored in the warehouse products. So, what we are doing is that when we create a product, then we also create the respective warehouse products, all with the same price.

The problem is when we want to do update operations. Shiphero API requires that each warehouse product has to be updated in a single GraphQL mutation. But with so many Warehouses, making that many requests to the API can be too unefficient.

I know that in GraphQL one can send many queries in one HTTP request, so I think this is the best option for me. I was trying to do that, the problem is that graphql is throwing me an error because I’m making duplicated mutations (see pictures).

I believe that we have to use GraphQL aliases, but I’m not an expert in this. Does anyone know how to do that?

This works (one warehouse):

This doesn’t work (two warehouses):

Hey @marioreinike,

I think this post might be of some help to you.

Would a mutation like this help:

mutation{
  
  alias_1:product_create(
    data: {
      name: "test-alias-1"
      sku: "test-alias-1"
      warehouse_products: { warehouse_id: "76733", on_hand: 0 }
    }
  ) {
    request_id
    complexity
  }
  
  
  alias_2:product_create(
    data: {
      name: "test-alias-2"
      sku: "test-alias-2"
      warehouse_products: { warehouse_id: "76733", on_hand: 0 }
    }
  ) {
    request_id
    complexity
  }
  
}

Please let me know if you have any questions or concerns. Don’t hesitate to reach out!

Best,
RayanP

1 Like

that’s what I needed. Thanks!

1 Like