productDeleteMedia mutation
Deletes media for a product.
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 productDeleteMedia($productId: ID!, $mediaIds: [ID!]!) { productDeleteMedia(productId: $productId, mediaIds: $mediaIds) {} } { “productId”: “Z2lkOi8vU2hvcGlmeS9FeGFtcGxlLzE=”, “mediaIds”: [
<font style="color:#1F61A0;">deletedMediaIds</font><font style="color:#1F61A0;">deletedProductImageIds</font><font style="color:#1F61A0;">mediaUserErrors</font> <font style="color:#555555;">{</font><font style="color:#1F61A0;">code</font><font style="color:#1F61A0;">field</font><font style="color:#1F61A0;">message</font><font style="color:#555555;">}</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:#D64292;">"Z2lkOi8vU2hvcGlmeS9FeGFtcGxlLzE="</font>
Arguments
Return fields
- deletedMediaIds (
[[ID!]](https://shopify.dev/docs/admin-api/graphql/reference/scalar#id-2021-01))
List of media IDs which were deleted. - deletedProductImageIds (
[[ID!]](https://shopify.dev/docs/admin-api/graphql/reference/scalar#id-2021-01))
List of product image IDs which were deleted. - mediaUserErrors (
[[MediaUserError!]!](https://shopify.dev/docs/admin-api/graphql/reference/products-and-collections/mediausererror))
List of errors that occurred executing the mutation. - product (
[Product](https://shopify.dev/docs/admin-api/graphql/reference/products-and-collections/product))
The product which media was deleted from. 
Deprecated return fields
userErrors ([[UserError!]!](https://shopify.dev/docs/admin-api/graphql/reference/usererror)) DEPRECATED
List of errors that occurred executing the mutation.
Deprecation warning
Use mediaUserErrors instead
