Currently, the productVariantsBulkUpdate API fails when a product variant contains an invalid metafield value, even when the requested update doesn’t involve modifying the metafield or metafield value itself. For example, attempting to update a product variant’s price may still fail due to an unrelated invalid metafield value.
Example error message:
Value does not exist in provided choices: [\"a\", \"b\", \"c\"]
Could we please adjust the API to only validate metafields when they are explicitly being updated? This would prevent unrelated updates (e.g., price changes) from failing due to pre-existing metafield issues (unrelated to the API caller).
When partial updates are allowed, valid variant changes may be persisted even if some of the variants updated have invalid data and cannot be persisted. When partial updates are not allowed, any error will prevent all variants from updating.
To clarify, I expect the price change to persist for the product variant with pre-existing invalid metafield data, given that the productVariantsBulkUpdate API call only modifies the price and doesn’t attempt to update any metafield values.
I would expect an error only if the API call tried to update the metafield with an invalid value.
Thank you so much. Just another question, are you able to update the item in the admin, or does that return errors as well? The reason I ask is to see if this is specific to the mutation or maybe the product variant itself.
I did some further digging and found this is a known issue/concern at the moment when updating unrelated fields. Our team is looking in to ways to improve this. I’ll be sure they see this post as well for an additional example.
Currently, the workaround would be to update the metafields or the definition so this error doesn’t occur. Most likely the definition was updated with some values removed so the current values on the variant are no longer valid, leading to the error.
I don’t have a timeline on a resolution, but I’ll keep my eyes on it and update here with any changes.