انتقل إلى المحتوى الرئيسي

wishlistRemoveItem

نظرة عامة

استخدم هذا الـ mutation لحذف منتج من قائمة رغبات الجلسة/الحساب. مرر المعرفات اللازمة عبر RemoveFromWishlistInput (معرفات الحساب/الجلسة بالإضافة إلى معلومات المنتج). يستجيب API ببيانات قائمة الرغبات المحدثة.

  • النوع: GraphQL Mutation
  • Endpoint: https://subdomain.com
  • المصادقة: Authorization: Bearer <TOKEN> (مطلوب لقوائم رغبات الحساب)

Mutation

mutation RemoveFromWishlist($input: RemoveFromWishlistInput!) {
removeFromWishlist(input: $input) {
success
message
data {
_id
accountId
sessionId
app
products {
_id
title
slug
description
app
tags
status
publishedAt
images { _id fileUrl }
collections {
_id
app
title
slug
description
operation
image { _id fileUrl }
}
seo { title description keywords image canonicalUrl }
pricing { compareAtPrice originalPrice price }
variantsCount
dimensions { height width unit }
weight { weight unit }
variants {
_id
product
options {
_id
option { name }
label
type
sortOrder
createdAt
updatedAt
}
images { _id fileUrl }
pricing { originalPrice price compareAtPrice }
quantity
weight { unit weight }
}
options {
_id
product
valuesCount
values { _id label type sortOrder createdAt updatedAt }
name
createdAt
updatedAt
}
}
createdAt
updatedAt
}
}
}

المتغيرات

{
"input": {
"accountId": "<ACCOUNT_ID>",
"sessionId": "<SESSION_ID>",
"productId": "<PRODUCT_ID>"
}
}

أمثلة

curl -X POST \
https://subdomain.com\
-H "Content-Type": "application/json" \
-H "Authorization: Bearer <TOKEN>" \
--data-binary @- << 'EOF'
{
"query": "mutation RemoveFromWishlist($input: RemoveFromWishlistInput!) { removeFromWishlist(input: $input) { success message data { _id products { _id title } } } }",
"variables": {
"input": {
"accountId": "<ACCOUNT_ID>",
"sessionId": "<SESSION_ID>",
"productId": "<PRODUCT_ID>"
}
}
}
EOF

ملاحظات

  • بعض التطبيقات تستنتج ملكية قائمة الرغبات؛ مرر إما accountId أو sessionId (أو كليهما) حسب المطلوب.
  • بعد الإزالة، زامن واجهة المستخدم مع data المُعادة لإظهار قائمة المنتجات المحدثة.