Skip to content
This repository was archived by the owner on Nov 19, 2024. It is now read-only.

Commit b8e17a7

Browse files
authored
Merge pull request #2885 from magento/kh_graphql-103-hidden-attributes
Filter out GraphQL product attributes
2 parents 9612dec + 24e178c commit b8e17a7

File tree

1 file changed

+32
-4
lines changed

1 file changed

+32
-4
lines changed

guides/v2.3/graphql/reference/products.md

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ Attribute | Description
2626
`currentPage` | Specifies which page of results to return. The default value is 1. See [Searches and pagination in GraphQL]({{ page.baseurl }}/graphql/search-pagination.html) for more information.
2727
`sort` | Specifies which attribute to sort on, and whether to return the results in ascending or descending order. See [Searches and pagination in GraphQL]({{ page.baseurl }}/graphql/search-pagination.html) for more information.
2828
`Products` | An output object that contains the results of the query. See [Response](#Response) for details.
29+
{:style="table-layout:auto;"}
2930

3031
## ProductFilterInput object {#ProductFilterInput}
3132

@@ -85,13 +86,25 @@ updated_at
8586
weight
8687
```
8788

88-
<div class="bs-callout bs-callout-info" id="info" markdown="1">
8989
The following attributes are not used in responses:
90+
9091
* `or` - The keyword required to perform a logical OR comparison.
9192
* `news_from_date` - This attribute is transformed to `news_from_date` in a response.
9293
* `news_to_date` - This attribute is transformed to `news_to_date` in a response.
93-
*
94-
</div>
94+
95+
{%
96+
include note.html
97+
type="info"
98+
content="GraphQL automatically filters out a product attribute if ALL of the following fields are set to **No** on the attribute's Storefront Properties page in Admin:
99+
100+
* Comparable on Storefront
101+
* Use in Layered Navigation
102+
* Use in Search Results Layered Navigation
103+
* Visible on Catalog Pages on Storefront
104+
* Used in Product Listing
105+
* Used for Sorting in Product Listing"
106+
107+
%}
95108

96109
## Response {#Response}
97110

@@ -114,7 +127,7 @@ Attribute | Description
114127
`total_count` | The number of products returned
115128
`filters` | An array of layered navigation filters. These filters can be used to implement layered navigation on your app.
116129
`sort_fields` | An object that includes the default sort field and all available sort fields
117-
130+
{:style="table-layout:auto;"}
118131

119132
When a product requires a filter attribute that is not a field on its output schema, inject the attribute name into the class in a module's `di.xml` file.
120133

@@ -191,6 +204,7 @@ Attribute | Data type | Description
191204
`type_id` | String | One of `simple`, `virtual`, `bundle`, `downloadable`,`grouped`, `configurable`
192205
`updated_at` | String | The timestamp indicating when the product was last updated
193206
`website_ids` | [Int] | An array of website IDs in which the product is available
207+
{:style="table-layout:auto;"}
194208

195209
### ProductPrices object {#ProductPrices}
196210

@@ -201,6 +215,7 @@ Attribute | Data Type | Description
201215
`maximalPrice` | Price | Used for composite (bundle, configurable, grouped) products. This is the highest possible final price for all the options defined within a composite product. If you're specifying a price range, this would be the "to" value.
202216
`minimalPrice` | Price | Used for composite (bundle, configurable, grouped) products. This is the lowest possible final price for all the options defined within a composite product. If you're specifying a price range, this would be the "from" value.
203217
`regularPrice` | Price | The base price of a product.
218+
{:style="table-layout:auto;"}
204219

205220
#### Price object {#Price}
206221

@@ -210,6 +225,7 @@ Attribute | Data Type | Description
210225
--- | --- | ---
211226
`amount` | Money | The price of the product and its currency code. See [Money object](#Money).
212227
`adjustments` | [PriceAdjustment] | An array of [PriceAdjustment](#PriceAdjustment) objects.
228+
{:style="table-layout:auto;"}
213229

214230
##### Money object {#Money}
215231

@@ -219,6 +235,7 @@ Attribute | Data Type | Description
219235
--- | --- | ---
220236
`value` | Float | The price of the product
221237
`currency` | CurrencyEnum | A three-letter currency code, such as `USD` or `EUR`.
238+
{:style="table-layout:auto;"}
222239

223240
##### PriceAdjustment array {#PriceAdjustment}
224241

@@ -229,6 +246,7 @@ Attribute | Data Type | Description
229246
`amount` | Money | The amount of the price adjustment and its currency code. See [Money object](#Money).
230247
`code` | PriceAdjustmentCodesEnum | One of `tax`, `weee`, or `weee_tax`.
231248
`description` | PriceAdjustmentDescriptionEnum | Indicates whether the entity described by the code attribute is included or excluded from the adjustment.
249+
{:style="table-layout:auto;"}
232250

233251
#### ProductLinks object {#ProductLinks}
234252

@@ -241,6 +259,7 @@ Attribute | Type | Description
241259
`linked_product_sku` | String | The SKU of the linked product
242260
`linked_product_type` | String | The type of linked product (`simple`, `virtual`, `bundle`, `downloadable`,`grouped`, `configurable`)
243261
`position` | Int | The position within the list of product links
262+
{:style="table-layout:auto;"}
244263

245264
### MediaGalleryEntry object {#MediaGalleryEntry}
246265

@@ -257,6 +276,7 @@ Field | Type | Description
257276
`file` | String | The path of the image on the server
258277
`content` | ProductMediaGalleryEntriesContent | Contains a [ProductMediaGalleryEntriesContent](#ProductMediaGalleryEntriesContent) object
259278
`video_content` | ProductMediaGalleryEntriesVideoContent | Contains a [ProductMediaGalleryEntriesVideoContent](#ProductMediaGalleryEntriesVideoContent) object
279+
{:style="table-layout:auto;"}
260280

261281
#### ProductMediaGalleryEntriesContent object {#ProductMediaGalleryEntriesContent}
262282

@@ -267,6 +287,7 @@ Field | Type | Description
267287
`base64_encoded_data` | String | The image in base64 format
268288
`type` | String | The MIME type of the file, such as `image/png`
269289
`name` | String | The file name of the image
290+
{:style="table-layout:auto;"}
270291

271292
#### ProductMediaGalleryEntriesVideoContent object {#ProductMediaGalleryEntriesVideoContent}
272293

@@ -280,6 +301,7 @@ Field | Type | Description
280301
`video_title` | String | Required. The title of the video
281302
`video_description` | String | A description of the video
282303
`video_metadata` | String | Optional data about the video
304+
{:style="table-layout:auto;"}
283305

284306
### ProductTierPrices object {#ProductTier}
285307

@@ -292,6 +314,7 @@ Field | Type | Description
292314
`value` | Float | The price of the fixed price item
293315
`percentage_value` | Float | The percentage discount of the item
294316
`website_id` | Int | The ID assigned to the website
317+
{:style="table-layout:auto;"}
295318

296319
## PhysicalProductInterface {#PhysicalProductInterface}
297320

@@ -300,6 +323,7 @@ Field | Type | Description
300323
Field | Type | Description
301324
--- | --- | ---
302325
`weight` | Float | The weight of the item, in units defined by the store
326+
{:style="table-layout:auto;"}
303327

304328
## LayerFilter object
305329

@@ -311,6 +335,7 @@ Field | Type | Description
311335
`request_var` | String | The request variable name for the filter query
312336
`filter_items_count` | Int | The number of filter items in filter group
313337
`filter_items` | [LayerFilterItemInterface] | An array of filter items
338+
{:style="table-layout:auto;"}
314339

315340
### LayerFilterItemInterface
316341

@@ -321,6 +346,7 @@ Field | Type | Description
321346
`label` | String | The label applied to a filter
322347
`value_string` | String | The value for filter request variable to be used in a query
323348
`items_count` | Int | The number of items the filter returned
349+
{:style="table-layout:auto;"}
324350

325351
## SortFields object
326352

@@ -330,13 +356,15 @@ Field | Type | Description
330356
--- | --- | ---
331357
`default` | String | The default sort field
332358
`options` | `SortField` | An array that contains all the fields you can use for sorting
359+
{:style="table-layout:auto;"}
333360

334361
### SortField object
335362

336363
Field | Type | Description
337364
--- | --- | ---
338365
`value` | String | The attribute name or code to use as the sort field
339366
`label` | String | The attribute's label
367+
{:style="table-layout:auto;"}
340368

341369
## Sample query
342370

0 commit comments

Comments
 (0)