productVariantDelete mutation
Deletes a product variant.
Required access
write_products access scope.
On this page
Interactive example
This is an example mutation query. Use the embedded interactive tool below to edit the query.
Hint: use Ctrl + Space for autocompleting fields.
mutation productVariantDelete($id: ID!) { productVariantDelete(id: $id) {} } { “id”: “Z2lkOi8vU2hvcGlmeS9FeGFtcGxlLzE=” }
<font style="color:#1F61A0;">deletedProductVariantId</font><font style="color:#1F61A0;">product</font> <font style="color:#555555;">{</font><font style="color:#1F61A0;">id</font><font style="color:#555555;">}</font><font style="color:#1F61A0;">userErrors</font> <font style="color:#555555;">{</font><font style="color:#1F61A0;">field</font><font style="color:#1F61A0;">message</font><font style="color:#555555;">}</font>
Arguments
| Argument | Description |
|---|---|
id( [ID!](https://shopify.dev/docs/admin-api/graphql/reference/scalar#id-2021-01)) REQUIRED |
ID of the product variant to be deleted. |
Return fields
- deletedProductVariantId (
[ID](https://shopify.dev/docs/admin-api/graphql/reference/scalar#id-2021-01))
ID of the deleted product variant. - product (
[Product](https://shopify.dev/docs/admin-api/graphql/reference/products-and-collections/product))
Product of the deleted product variant. - userErrors (
[[UserError!]!](https://shopify.dev/docs/admin-api/graphql/reference/usererror))
List of errors that occurred executing the mutation.
