Have your say in Community Polls: What was/is your greatest motivation to start your own business?
Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

MISSING InventoryItemInput in ProductVariantSetInput

Solved

MISSING InventoryItemInput in ProductVariantSetInput

adearriba
Shopify Partner
13 1 15

Hi,

 

I want to create my variants using ProductSet new API but there is no way of marking the variants as "tracked". 

 

ProductVariantInput has an inventoryItem object where you can mark the tracked option as true.

 

ProductVariantSetInput doesn't have this option. It only allows for inventoryPolicy, but not for inventoryItem tracked.

 

It would be super helpful to have the ability to mark a variant a tracked by using the ProductSet API. If not, then you will always need multiple GraphQL mutations to achieve this and the new Product model goal won't be achieve.

Best,
Alejandro.
Accepted Solution (1)

AsafGitai
Shopify Staff
109 16 45

This is an accepted solution.

Hi @adearriba 

Our thinking is that If you want to create a product with tracking quantity, then you probably also want to be able to set quantities.
This means you will need to do inventory updates anyways. For those we currently support via

https://shopify.dev/docs/api/admin-graphql/unstable/mutations/inventoryItemUpdate
or
https://shopify.dev/docs/api/admin-graphql/unstable/mutations/productVariantsBulkUpdate

View solution in original post

Replies 8 (8)

AsafGitai
Shopify Staff
109 16 45

This is an accepted solution.

Hi @adearriba 

Our thinking is that If you want to create a product with tracking quantity, then you probably also want to be able to set quantities.
This means you will need to do inventory updates anyways. For those we currently support via

https://shopify.dev/docs/api/admin-graphql/unstable/mutations/inventoryItemUpdate
or
https://shopify.dev/docs/api/admin-graphql/unstable/mutations/productVariantsBulkUpdate

adearriba
Shopify Partner
13 1 15

Thanks, @AsafGitai.

My thinking is: I would like to have an API that lets me configure my product and all it's variants in one shot. I will then have a separate process to update inventory quantities per location as that is a many to many relationship which requires more resources.

 

The inventory tracking flag is at the inventoryItem level as others properties which are available like harmonizedSystemCode or weight and weight unit.  The inventory quantity is at inventoryLevel level. 

 

Being consistent with the property level, I think it would be best to have the tracking flag added too. Not sure if this can be suggested to the team for a future release.

Best,
Alejandro.
EnbitAs
Shopify Partner
3 0 9

I don't see how you can consider this as the accepted solution, as you mentioned this not resolve the main Problem.

CSBere
Shopify Partner
1 0 3
Your thoughts are not clear to me! The inventory Update mutation allows you to modify the tracked property, but not the quantity, while the "productVariantsBulkUpdate" mutation does not allow you to modify the quantities of already existing variants (absurd!). So what would be the solution to both change quantities and enable inventory tracking in a single call?
EnbitAs
Shopify Partner
3 0 9

Hi @AsafGitai 

I don't see how this will solve the problem that @adearriba  mentioned.

using of productSet mutation meaning that I follow the Database sync workflow, usually from my local ERP system, und logically I will use the bulk operations.

 

so I don't see why I will use productVariantsBulkUpdate to manage my inventory!! this mutation give me the ability to update the quantity for all variants which belong to the same Product.

so for example if I have 1K Product ( and I have a lot more) with 4-5 variants for every products,  then I must call the inventoryItemUpdate mutation 4-5K time to track the quantity for every variant/inventoryItem, Or productVariantsBulkUpdate mutation 1k time.

 

so I can't see that as a solution for Database sync workflow, for this workflow I will use :
https://shopify.dev/docs/api/admin-graphql/unstable/mutations/inventorySetQuantities
to set the quantity from my ERP to multiple variants without thinking of grouping them pro product, but to do this I must track the inventoryItem , and this take use to @adearriba  question , why you remove the inventoryItem Object form ProductVariantSetInput in the first place, when the goal of using productSet mutation is to make the ERP Data sync faster ??!!!

and as another point, you didn't give us the ability to add the product media in productSet mutation as it in productCreate, and in the same time the productCreateMedia is not available in bulk operations, that mean if I want to create 100 new product using productSet /bulk operations, then I must send 100 request afterword to create the media for every product I created.

 

so I thought that I can use the following logic for my Database sync workflow :

  • bulk request to create the product with the media using productCreate mutation
  • then another bulk request to create the product variants using productVariantCreate , but surprise 🤔 when I recheck this mutation is not available in Bulk operation.😫😥 

NOTE: I know that there are a productVariantsBulkCreate mutation but I must send a request for every product so this is not really a solution for this workflow.

so at the end I use it like this :

  • bulk request to create the product with the media using productCreate mutation and be sure to include the productOptions Object to create dummy variants and then I save the ids in my local database
  • then bulk request to update the dummy variants with the correct data and track the inventory item using productVariantUpdate which it is available in bulk operation.🙄
  • then send a bulk request to publish the products using publishablePublish, because in productCreate mutation publications object marked as deprecated and in productSet the publications object is not exist.


I think this is a lot of work for some one use the Database sync workflow.

 

I hope that your team consider the following point:
1- in ProductSet mutation add the inventoryItem object and the publications object and the ability to add the media ( if adding the media is not possible then can you add the productCreateMedia to the bulk operation ) so man can use this mutation for one shot update in Database sync workflow

2- if this is not possible so can you add the productVariantCreate or even better productVariantsBulkCreate to the bulk operation.

 

Regards

ronald_g
Explorer
80 2 16

Hi @AsafGitai 

What about other attributes like weight? It's not in `ProductVariantSetInput`, so we'll need to use `inventoryItemUpdate` in addition to `productSet` for weight as well?

EnbitAs
Shopify Partner
3 0 9

Hi @AsafGitai 

Shopify provides the productSet mutation as a solution for database sync workflows, such as syncing data from an ERP system. Logically, in this case, I would use the bulk operation.

In such a workflow, I can't see how using the inventoryItemUpdate or productVariantsBulkUpdate mutations would be a viable solution for managing inventory or solving the inventory item tracking issue.

Let's consider we have 5K products with 4-5 variants for each product. If I were to use productVariantsBulkUpdate, I would need 5K requests, and with inventoryItemUpdate, I would need 20-25K requests to track the inventory items.

For database sync workflows, I would use inventorySetQuantities, which allows me to update multiple variant quantities without grouping them at the product level.

This brings us to @adearriba  question: why did you remove the inventoryItem object in the first place?

On the other hand, we can't send media using productSet as we do with the productCreate mutation. To complicate matters, productCreateMedia is not available in bulk operations.

So, if I want to use productSet to create 100 new products with 4-5 variants each, I would need to send 100 requests to productVariantsBulkUpdate to track the inventory items, or 400-500 requests using inventoryItemUpdate. Then, I must send another 100 requests to create the media using productCreateMedia, and another 100 requests to publish the products using publishablePublish because the publications object is also removed from productSet.

This is a lot of work for a database sync workflow. In this workflow, I expected that productSet would sync the data in one shot.

As a workaround, I thought to use the following steps:

  • Use bulk operations to create the products with media using the productCreate mutation.
  • Then use bulk operations to create the product variants and track the inventory items using the productVariantCreate mutation. However, I was surprised to find that this mutation is not available in bulk operations.

So, I changed the plan to:

  • Use bulk operations to create the products with media using the productCreate mutation and make sure to use the productOptions object to create dummy variants.
  • Use bulk operations to update the dummy variants with the correct data and track the inventory items using productVariantUpdate.
  • Use bulk operations to publish the products using publishablePublish.

But this is still a lot of work for a database sync workflow.

I hope that your team considers the following points:

  1. Modify the productSet mutation to accept the inventoryItem object and the publications object. It would be perfect if we could add the media too. If not, then at least add productCreateMedia to bulk operations so we can truly use productSet to sync the data in one shot.
  2. If this is not possible, can you at least add productVariantCreate to bulk operations?

Regards,

DavidT
Shopify Partner
38 2 16

Can you please reconsider? As others have mentioned there's other fields on InventoryItemInput now, such as weight and HS code, and there's no way to update that with productSet. This is a critical issue honestly.

QuickEdit - Bulk Product Edit - Quick and easy bulk editor for products, variants, and collections.
SafeShip - Address Validator - International address validation and PO box blocking at checkout for Shopify Plus merchants.