You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Nov 19, 2024. It is now read-only.
The `customAttributeMetadata` endpoint returns the attribute type, given an attribute code and entity type. All entity attributes can be added to an equivalent GraphQL type, including custom, extension, and EAV (which have precedence set in that order for collisions). The ability to know the type of attribute a given field is obscured from the GraphQL query consumer.
6
+
The `customAttributeMetadata` endpoint returns the attribute type, given an attribute code and entity type. All entity attributes can be added to an equivalent GraphQL type, including custom, extension, and EAV (which have precedence set in that order for collisions). The GraphQL query consumer does not have the ability to know a field's attribute type.
7
+
8
+
## Supported attributes
9
+
10
+
Attribute | Data Type | Description
11
+
--- | --- | ---
12
+
`attribute_code` | String | The unique identifier for an attribute code. This value should be in lowercase letters without spaces.
13
+
`entity_type` | String | The type of entity that defines the attribute
14
+
`attribute_type` | String | The data type of the attribute (Response only)
15
+
`attribute_options` | `AttributeOption` | A list of attribute options
16
+
{:style="table-layout:auto;"}
17
+
18
+
### AttributeOption object
19
+
20
+
Attribute | Data Type | Description
21
+
--- | --- | ---
22
+
`label` | String | The name of an attribute option
23
+
`value` | String | The value assigned to an attribute option
24
+
{:style="table-layout:auto;"}
7
25
8
26
## Example usage
9
27
@@ -13,42 +31,25 @@ The following query returns the attribute type for various custom and EAV attrib
13
31
14
32
{% highlight json %}
15
33
{
16
-
customAttributeMetadata(attributes:
17
-
[
18
-
{
19
-
attribute_code: "available_sort_by",
20
-
entity_type: "catalog_category"
21
-
},
22
-
{
23
-
attribute_code: "quantity_and_stock_status",
24
-
entity_type: "catalog_product"
25
-
},
26
-
{
27
-
attribute_code: "default_billing",
28
-
entity_type: "customer"
29
-
},
30
-
{
31
-
attribute_code: "region"
32
-
entity_type: "customer_address"
33
-
},
34
-
{
35
-
attribute_code: "media_gallery",
36
-
entity_type: "catalog_product"
37
-
}
38
-
]
39
-
)
40
-
{
41
-
items
42
-
{
43
-
attribute_code
44
-
entity_type
45
-
attribute_type
46
-
}
47
-
}
34
+
customAttributeMetadata(
35
+
attributes: {
36
+
attribute_code: "color"
37
+
entity_type: "4"
38
+
}
39
+
) {
40
+
items {
41
+
attribute_code
42
+
entity_type
43
+
attribute_type
44
+
attribute_options {
45
+
value
46
+
label
47
+
}
48
+
}
48
49
}
50
+
}
49
51
{% endhighlight %}
50
52
51
-
The key you're storing EAV attributes under
52
53
**Response**
53
54
54
55
{% highlight json %}
@@ -57,40 +58,74 @@ The key you're storing EAV attributes under
0 commit comments