Skip to content

Commit b59adb8

Browse files
authored
DEVDOCS-6378 - Wishlists not documented (#1078)
Added a reference for wishlist queries in the examples area in response to the increased complexity of certain wishlist fields. <!-- Ticket number or summary of work --> # [DEVDOCS-6378] ## What changed? * Wishlist complexity within GraphQL was changed. * Previously we didn't document wishlists outside of the GQL reference pages. ## Release notes draft * We've added examples of wishlist queries to the storefront GraphQL documentation along with a callout about complexity limits imposed by certain fields ## Anything else? ping { @bigcommerce/dev-docs-team } [DEVDOCS-6378]: https://bigcommercecloud.atlassian.net/browse/DEVDOCS-6378?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
1 parent c0019d7 commit b59adb8

File tree

1 file changed

+137
-0
lines changed

1 file changed

+137
-0
lines changed

docs/storefront/graphql/examples/index.mdx

Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -396,3 +396,140 @@ The `geography` node currently supports two filters, both available on the level
396396
</Tab>
397397
</Tabs>
398398
<a href="https://developer.bigcommerce.com/graphql-storefront/playground" target="_blank">**Try it in GraphQL Playground**</a>
399+
400+
## Get wishlist information
401+
402+
Wishlists are accessible through GraphQL and offer access to all standard wishlist management functions. In addition to retrieving information through the queries `customers.wishlists` and `site.publicWishlist` outlined below, the mutations `createWishlist`, `addWishlistItems`, `deleteWishlistItems`, `updateWishlist`, and `deleteWishlists` are provided for managing customer wishlists.
403+
404+
Public wishlists are read-only within GraphQL.
405+
406+
<Callout type="warning">
407+
The `items` field in both customer and public wishlist queries greatly increases query complexity. This means that the cost for deeply nested or large queries involving wishlist items grows rapidly. As a result, complex queries may hit rate or complexity limits sooner than expected. For platform stability, plan queries with this in mind and retrieve only the data you need.
408+
</Callout>
409+
410+
### Customer wishlists
411+
412+
Customer wishlists are queried based on the current customer session, using the token generated during the authentication process to identify the customer for the query's response data.
413+
414+
<Tabs items={['Query', 'Response']}>
415+
<Tab>
416+
417+
```graphql copy filename="Example Query: Customer wishlists"
418+
query {
419+
customer {
420+
wishlists {
421+
edges {
422+
node {
423+
id
424+
name
425+
items {
426+
edges {
427+
node {
428+
entityId
429+
productName
430+
}
431+
}
432+
}
433+
}
434+
}
435+
}
436+
}
437+
}
438+
```
439+
440+
</Tab>
441+
<Tab>
442+
443+
```json copy filename="Example Response: Customer wishlists"
444+
{
445+
"data": {
446+
"customer": {
447+
"wishlists": {
448+
"edges": [
449+
{
450+
"node": {
451+
"id": "1",
452+
"name": "My Wishlist",
453+
"items": {
454+
"edges": [
455+
{
456+
"node": {
457+
"entityId": 101,
458+
"productName": "T-shirt"
459+
}
460+
},
461+
{
462+
"node": {
463+
"entityId": 102,
464+
"productName": "Jeans"
465+
}
466+
}
467+
]
468+
}
469+
}
470+
}
471+
]
472+
}
473+
}
474+
}
475+
}
476+
```
477+
478+
</Tab>
479+
</Tabs>
480+
481+
### Public wishlists
482+
483+
You can also access public wishlists using a token. The `items` field in public wishlists is affected by the same complexity considerations:
484+
485+
<Tabs items={['Query', 'Response']}>
486+
<Tab>
487+
488+
```graphql copy filename="Example Query: Shared wishlists"
489+
query {
490+
site {
491+
publicWishlist(token: "TOKEN_HERE") {
492+
id
493+
name
494+
items {
495+
edges {
496+
node {
497+
entityId
498+
productName
499+
}
500+
}
501+
}
502+
}
503+
}
504+
}
505+
```
506+
507+
</Tab>
508+
<Tab>
509+
510+
```json copy filename="Example Response: Shared wishlists"
511+
{
512+
"data": {
513+
"site": {
514+
"publicWishlist": {
515+
"id": "2",
516+
"name": "Holiday Gifts",
517+
"items": {
518+
"edges": [
519+
{
520+
"node": {
521+
"entityId": 201,
522+
"productName": "Coffee Mug"
523+
}
524+
}
525+
]
526+
}
527+
}
528+
}
529+
}
530+
}
531+
```
532+
533+
</Tab>
534+
</Tabs>
535+
<a href="https://developer.bigcommerce.com/graphql-storefront/playground" target="_blank">**Try it in GraphQL Playground**</a>

0 commit comments

Comments
 (0)