Clarifying the JSON/GraphQL variable format for Shopify Admin mutations to delete products and variants; initial attempts using arrays of IDs were rejected.
Key findings:
productDelete accepts only a single product ID per call; no bulk product delete is available in the referenced API.
productVariantDelete also expects a single ID. For multiple variants, use productVariantsBulkDelete.
Usage notes:
Variables must match the mutation’s declared parameters (named fields), not arrays of objects.
productVariantsBulkDelete takes productId (ID) and variantsIds ([ID!]).
Outcome:
The issue was resolved by performing single product deletes and using the bulk variant deletion mutation for variants.
A request remains for a product bulk delete capability; no solution was identified.
Context:
Code snippets are central to understanding the discussion; no images or other attachments were used.
Status:
Resolved for variants (via bulk mutation). Open for products (no bulk delete).
Summarized with AI on February 14.
AI used: gpt-5.
Please help me to correct the format for the JSONs used in the GraphQL operations productDelete and productVariantDelete.
JSONS are valid and look to me like I have the correct setup for this mutation but somehow the format is not accepted. It seems a different array is expected. Did not find an example.
Please have a look it is much appreciated.
Also it will help the next person struggling with this
I tried again but I do not find the right format.. unfortunately with graphql you cannot send a get request and find what is needed like in Rest.
It has to be a quite simple solution though.