does not working on webook sellingPlanGroupRemove: ProductVariants and AddProductVariants

does not working on webook sellingPlanGroupRemove: ProductVariants and AddProductVariants

Dzonotonas
Shopify Partner
33 2 15

Hello, 👋

 

Is there another way to update the selling plan for product variants?

 

When merchants update a product, I want to update the selling plan for product variants based on X conditions. What I'm doing is removing all product variants from https://shopify.dev/docs/api/admin-graphql/2024-10/mutations/sellingPlanGroupRemoveProductVariants and then adding the appropriate ones with https://shopify.dev/docs/api/admin-graphql/2024-10/mutations/sellingPlanGroupAddProductVariants. This works perfectly when using the app, but when the webhook is triggered, the add mutation fails and returns an error:

{ field: [ 'productVariantIds' ], message: 'Resource has already been taken' }

 

As I mentioned, it works fine in the app, without errors, but not on the webhook. Why is that? Is it due to Shopify's cache?

Replies 0 (0)