productReviewRatingsMetadata query

The productReviewRatingsMetadata query returns the active ratings attributes and the values each rating can have. In Luma, these values are one star through five stars.

Use the createProductReview mutation to add a product review.

Syntax

productReviewRatingsMetadata: ProductReviewRatingsMetadata!

Example usage

The following query returns the metadata for all active ratings attributes. In this example, the default Rating attribute has been renamed to Overall, and the Quality and Value attributes have been enabled.

Request:

1
2
3
4
5
6
7
8
9
10
11
12
query {
  productReviewRatingsMetadata {
    items {
      id
      name
      values {
        value_id
        value
      }
    }
  }
}

Response:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
{
  "data": {
    "productReviewRatingsMetadata": {
      "items": [
        {
          "id": "NA==",
          "name": "Overall",
          "values": [
            {
              "value_id": "MTY=",
              "value": "1"
            },
            {
              "value_id": "MTc=",
              "value": "2"
            },
            {
              "value_id": "MTg=",
              "value": "3"
            },
            {
              "value_id": "MTk=",
              "value": "4"
            },
            {
              "value_id": "MjA=",
              "value": "5"
            }
          ]
        },
        {
          "id": "MQ==",
          "name": "Quality",
          "values": [
            {
              "value_id": "MQ==",
              "value": "1"
            },
            {
              "value_id": "Mg==",
              "value": "2"
            },
            {
              "value_id": "Mw==",
              "value": "3"
            },
            {
              "value_id": "NA==",
              "value": "4"
            },
            {
              "value_id": "NQ==",
              "value": "5"
            }
          ]
        },
        {
          "id": "Mg==",
          "name": "Value",
          "values": [
            {
              "value_id": "Ng==",
              "value": "1"
            },
            {
              "value_id": "Nw==",
              "value": "2"
            },
            {
              "value_id": "OA==",
              "value": "3"
            },
            {
              "value_id": "OQ==",
              "value": "4"
            },
            {
              "value_id": "MTA=",
              "value": "5"
            }
          ]
        }
      ]
    }
  }
}

Input attributes

Not applicable

Output attributes

The ProductReviewRatingsMetadata output object contains the items object.

Attribute Data type Description
items [ProductReviewRatingMetadata!]! A list of product reviews, sorted by position

ProductReviewRatingMetadata attributes

The ProductReviewRatingMetadata object contains the following attributes.

Attribute Data type Description  
id String!   An encoded rating ID
name String! The label assigned to an aspect of a product that is being rated, such as quality or price  
values [ProductReviewRatingValueMetadata!]! A list of product review ratings, sorted by position  

ProductReviewRatingValueMetadata attributes

The ProductReviewRatingValueMetadata object contains the following attributes.

Attribute Data type Description
value String! A ratings scale, such as the number of stars awarded
value_id String! An encoded rating value ID