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

collectionProducts

نظرة عامة

اجلب قائمة مُرقمة من المنتجات لـ handle مجموعة معين.

  • النوع: GraphQL Query
  • Endpoint: https://subdomain.com
  • المصادقة: Authorization: Bearer <TOKEN>

Query

query GetAllProductsByCollectionHandle($handle: String!) {
getAllProductsByCollectionHandle(handle: $handle) {
success
message
data {
_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
}
}
pagination {
totalItems
totalPages
currentPage
limit
hasNextPage
}
}
}

المتغيرات

{
"handle": "<COLLECTION_HANDLE>"
}

أمثلة

curl -X POST \
https://subdomain.com \
-H "Content-Type": "application/json" \
-H "Authorization: Bearer <TOKEN>" \
--data-binary @- << 'EOF'
{
"query": "query GetAllProductsByCollectionHandle($handle: String!) { getAllProductsByCollectionHandle(handle: $handle) { success message data { _id title slug } pagination { totalItems totalPages currentPage limit hasNextPage } } }",
"variables": { "handle": "<COLLECTION_HANDLE>" }
}
EOF

ملاحظات

  • استبدل <TOKEN> و <COLLECTION_HANDLE> بقيم صالحة.
  • أضف/احذف الحقول داخل data وفقاً لاحتياجات واجهتك؛ الـ query الكامل أعلاه يُظهر شكلاً شاملاً.
  • استخدم كائن pagination لتنفيذ عناصر تحكم الصفحات على جانب العميل.