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.

productSet mutation is a huge step back

Solved

productSet mutation is a huge step back

tolgapaksoy
Shopify Partner
112 7 76

Where I first could create a product for a fulfillment service in a single mutation, with inventory at the fulfillment service location with their inventories, I now need to fire many many mutations just to create a single product with their variants correctly.

 

  1. Create a product with their variants using `productSet`
  2. This creates the product at the default location of the store (which is not what I want)
  3. I then need to fire off `inventoryItemUpdate` mutation for each variant to set `tracked: true`
  4. I then fire a `inventoryActivate` mutation for each variant to activate them for the Fulfillment service location
  5. But then, all the variants are still activated for the default location of the store, WHICH IS NOT WHAT I WANT
  6. So then I need to figure out the default location ID, and deactivate each variant for the default location

I saw another community member having the same issues: https://community.shopify.com/c/new-graphql-product-apis/troubles-with-fulfillment-service-location/...

 

This is an awful flow. How does anyone cope with these changes? I am 100% sure that with 2024-07 I will be fighting with API rate limits constantly.

 

Does anyone have any suggestions to clean up the flow I went with?

Accepted Solution (1)
AsafGitai
Shopify Staff
109 16 45

This is an accepted solution.

Replies 7 (7)

tolgapaksoy
Shopify Partner
112 7 76

I found out from the recent AMA about these new APIs that I should be doing the following:

 

https://community.shopify.com/c/community-amas-ask-me-anything/shopify-community-ama-with-shopify-de...

 

I should be using productCreate without passing any variants. And then using productVariantsBulkCreate with strategy: REMOVE_STANDALONE_VARIANT. This allows me to create the product with correct options and optionValues in 1 mutation, and then add its variants in a single followup mutation that also provides the fulfillment service location ID, and their starting quantities. That way I only need to fire 2 mutations per product.

 

Basically my suggestion: do not use productSet if you care about which location your variants are stocked

jannick_093
Shopify Partner
1 0 1

In the new API version 2024-10, inventoryQuantities has been added, which now makes it possible to directly activate a product at a desired location. This way, an inventoryItem is created for the respective product at the correct location.

 

However, it is still not possible to update the inventoryItem directly, which means the property tracked is set to false. We now have to create an additional bulk task to update all inventoryItems to tracked=true.

 

We are being forced to update the entire flow for 2025, but this still works incompletely. Could we please get an indication of whether this feature will be added, and when? If it's not available in time, we will have to implement a suboptimal flow.

 

Does anyone know more about this, or perhaps another interesting implementation?

AsafGitai
Shopify Staff
109 16 45

This is an accepted solution.

Hi folks,

We have added support for inventory in productSet in 2024-10
https://shopify.dev/changelog/new-inventory-input-fields-in-productset-mutation-in-version-2024-10

tolgapaksoy
Shopify Partner
112 7 76

Thank you @AsafGitai , will a variant be automatically marked as tracked: true if you pass in inventoryQuantities while creating it?

stefanb1234
Shopify Partner
19 0 9

I am currently using it and it does not appear to set the tracked:true. Prolly we still need to run the other mutation

stefanb1234
Shopify Partner
19 0 9

Hmm, In my case I don't mind that productSet can't do it all, I also checked out the FAQ on it and it makes sense. But I think all other use-cases that are tied with products should also be bulkable. The list is short and it's a bit odd to build a pipeline that's meant for bulk, and then at the end have to send lots of requests for each product to do little fixes such as marking it `tracked`.

B__
Shopify Partner
17 1 6

If we can have inventoryItem so we can set the cost of the product, productSet would be perfect (to us)