Skip to main content

ProductMedia Object

Represents a product media.

type ProductMedia implements Node, ObjectWithMetadata {
id: ID!
privateMetadata: [MetadataItem!]!
privateMetafield(
key: String!
): String
privateMetafields(
keys: [String!]
): Metadata
metadata: [MetadataItem!]!
metafield(
key: String!
): String
metafields(
keys: [String!]
): Metadata
sortOrder: Int
alt: String!
translation(
languageCode: LanguageCodeEnum!
): ProductMediaTranslation
type: ProductMediaType!
oembedData: JSONString!
url(
size: Int
format: ThumbnailFormatEnum = ORIGINAL
): String!
productId: ID
}

Fields​

id ● ID!​

The unique ID of the product media.

privateMetadata ● [MetadataItem!]!​

List of private metadata items. Requires staff permissions to access.

privateMetafield ● String​

A single key from private metadata. Requires staff permissions to access.

Tip: Use GraphQL aliases to fetch multiple keys.

key ● String!​

privateMetafields ● Metadata​

Private metadata. Requires staff permissions to access. Use keys to control which fields you want to include. The default is to include everything.

keys ● [String!]​

metadata ● [MetadataItem!]!​

List of public metadata items. Can be accessed without permissions.

metafield ● String​

A single key from public metadata.

Tip: Use GraphQL aliases to fetch multiple keys.

key ● String!​

metafields ● Metadata​

Public metadata. Use keys to control which fields you want to include. The default is to include everything.

keys ● [String!]​

sortOrder ● Int​

The sort order of the media.

alt ● String!​

The alt text of the media.

translation ● ProductMediaTranslation​

Returns translated product media fields for the given language code.

Added in Saleor 3.23
languageCode ● LanguageCodeEnum!​

A language code to return the translation for product media.

Added in Saleor 3.23

type ● ProductMediaType!​

The type of the media.

oembedData ● JSONString!​

The oEmbed data of the media.

url ● String!​

The URL of the media.

size ● Int​

Desired longest side the image in pixels. Defaults to 4096. Images are never cropped. Pass 0 to retrieve the original size (not recommended).

format ● ThumbnailFormatEnum​

The format of the image. When not provided, format of the original image will be used.

productId ● ID​

Product id the media refers to.

Interfaces​

Node​

An object with an ID

ObjectWithMetadata​

Member Of​

Product object ● ProductMediaCreate object ● ProductMediaCreated object ● ProductMediaDelete object ● ProductMediaDeleted object ● ProductMediaReorder object ● ProductMediaTranslatableContent object ● ProductMediaTranslate object ● ProductMediaUpdate object ● ProductMediaUpdated object ● ProductVariant object ● VariantMediaAssign object ● VariantMediaUnassign object

Implemented By​

_Entity union