Shopify productSet Can Delete Missing Variants: Treat It as a Full Catalog Sync
GraphQL productSet is a state-reconciliation mutation, not a harmless partial patch for variants. Learn when omitted list entries can be deleted and how to test ERP syncs safely.
Quick answer: Use productSet when an external system is the source of truth for the product’s complete state. Unlike a small productUpdate patch, productSet reconciles list fields such as variants against the supplied list. Existing variants omitted from a supplied variants list can be removed. For a one-off variant edit, use productVariantsBulkUpdate instead.
On this page
Why it happens
An ERP export often contains only changed rows. Sending that delta as a complete variants list to productSet tells Shopify that the listed variants are the desired final state. The result can be deleted variants, changed option combinations, broken deep links or inventory mismatches. Scalar fields behave differently: omitted scalar fields are generally left unchanged.
Implementation
Define field ownership before writing. For a full sync, fetch the complete authoritative variant set, map stable Shopify IDs and option values, validate count and uniqueness, and stage a diff showing creates, updates and deletes. Reject suspiciously small exports rather than treating them as intentional deletions. For incremental variant-only updates use productVariantsBulkUpdate. For large complete syncs consider productSet with synchronous:false, then poll productOperation and inspect userErrors before marking the job successful.
Example
mutation SyncProduct($identifier: ProductSetIdentifiers, $input: ProductSetInput!) { productSet(identifier: $identifier, input: $input, synchronous: false) { productSetOperation { id status userErrors { field message } } userErrors { field message } } }
Pass the full intended option and variant state when those lists are included. Persist the operation ID and verify the resulting product; a queued operation is not a completed catalog sync.
Common misunderstanding: Omitting a field from productSet is the same as including an incomplete list. It is not: omitted scalar fields are not overwritten, but included list fields are reconciled. Another mistake is assuming the initial asynchronous response means the catalog is ready for sale.
How to test this: Create a staging product with three variants and distinct SKUs. Run a complete sync and verify all remain. Deliberately simulate an incomplete two-row export in a disposable test product and inspect the diff before any write; confirm the safeguard rejects it. Test a single variant price change through productVariantsBulkUpdate. For async syncs, poll until completion, inspect userErrors and compare SKU, option values, variant IDs, prices and inventory relationships.