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

Commit 00f5d7a

Browse files
Update products.md (#8322)
Add New example to fetch product information using filter by SKU. Remove one line `The SKU begins with 24-MB`. Line is incorrect because response of the query value contains SKU like `24-WB04` Co-authored-by: Kevin Harper <keharper@users.noreply.github.com>
1 parent 25bd5fb commit 00f5d7a

File tree

1 file changed

+63
-2
lines changed

1 file changed

+63
-2
lines changed

src/guides/v2.4/graphql/queries/products.md

Lines changed: 63 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -411,12 +411,11 @@ The search returns 45 items, but only the first two items are returned on the cu
411411
}
412412
```
413413

414-
### Full text search with filter
414+
### Full text search with filter by price attribute
415415

416416
The following sample query returns a list of products that meets the following criteria:
417417

418418
- The product name, product description, or related field contains the string `Messenger` (which causes it to be available for full text searches).
419-
- The SKU begins with `24-MB`
420419
- The price is less than $50.
421420

422421
The response for each item includes the `name`, `sku`, and `price` only. Up to 25 results are returned at a time, in decreasing order of price.
@@ -504,6 +503,68 @@ The response for each item includes the `name`, `sku`, and `price` only. Up to 2
504503
}
505504
```
506505

506+
### Query with filter by SKU attribute
507+
508+
The following sample query returns product by SKU. You have to pass SKU value to return product information.
509+
510+
**Request:**
511+
512+
```graphql
513+
{
514+
products(filter: { sku: { eq: "24-MB01" } }) {
515+
items {
516+
name
517+
sku
518+
url_key
519+
stock_status
520+
price_range {
521+
minimum_price {
522+
regular_price {
523+
value
524+
currency
525+
}
526+
}
527+
}
528+
}
529+
total_count
530+
page_info {
531+
page_size
532+
}
533+
}
534+
}
535+
```
536+
537+
**Response:**
538+
539+
```json
540+
{
541+
"data": {
542+
"products": {
543+
"items": [
544+
{
545+
"name": "Joust Duffle Bag",
546+
"sku": "24-MB01",
547+
"url_key": "joust-duffle-bag",
548+
"stock_status": "IN_STOCK",
549+
"price_range": {
550+
"minimum_price": {
551+
"regular_price": {
552+
"value": 34,
553+
"currency": "USD"
554+
}
555+
}
556+
}
557+
}
558+
],
559+
"total_count": 1,
560+
"page_info": {
561+
"page_size": 20
562+
}
563+
}
564+
}
565+
}
566+
```
567+
507568
### Query with layered navigation
508569

509570
The following query returns aggregations for a query that filters on items with these characteristics:

0 commit comments

Comments
 (0)