getDiscountByMarker
الحصول على خصم واحد حسب علامته.
الوصف
يجلب خصمًا حسب علامته ويُعيد IDiscountsEntity.
.getDiscountByMarker(
,
);
مخطط المعلمات
المخطط
marker(required): string
علامة الخصم.
مثال: "discount_storage"
langCode: string
رمز اللغة. الافتراضي: langCode المُمرَّر إلى defineOneEntry ("en_US" إذا لم يُمرَّر).
مثال: "en_US"
أمثلة
مثال بسيط
const response = await Discounts.getDiscountByMarker('example_discount');
مثال مع المعلمات الاختيارية
const response = await Discounts.getDiscountByMarker('example_discount', 'en_US');
مثال على الاستجابة
{
"id": 1,
"type": "DISCOUNT",
"attributeSetId": 31,
"conditionLogic": "AND",
"discountValue": {
"value": 10,
"maxAmount": 5,
"discountType": "FIXED_AMOUNT",
"applicability": "TO_PRODUCT"
},
"exclusions": null,
"gifts": null,
"giftsReplaceCartItems": false,
"userGroups": null,
"userExclusions": null,
"localizeInfos": {
"title": "Example discount"
},
"version": 0,
"total": "1",
"identifier": "example_discount",
"startDate": "2026-03-14T14:55:19.928Z",
"endDate": "2026-07-31T13:55:24.647Z",
"attributeValues": {
"example_discount": {
"type": "string",
"value": "test value",
"isIcon": false,
"position": 0,
"additionalFields": {},
"isProductPreview": false
}
},
"conditions": [],
"bonusEvent": null,
"position": 1
}
مخطط الاستجابة
المخطط: IDiscountsEntity
id: number
معرّف الخصم.
attributeSetId: number | null
معرّف مجموعة السمات المرتبطة بالخصم، أو null إذا لم تُرتبط أي مجموعة.
localizeInfos: ILocalizeInfo
الاسم المترجم للخصم.
version: number
رقم إصدار الخصم.
identifier: string
علامة الخصم.
type: IDiscountType
نوع الخصم.
startDate: string
تاريخ بدء الخصم.
endDate: string
تاريخ انتهاء الخصم.
discountValue: IDiscountValue
قيمة الخصم مع نوعها وحدود المبلغ.
discountValue.applicability: 'TO_PRODUCT' | 'TO_ORDER'
ما ينطبق عليه الخصم.
مثال: "TO_PRODUCT"
discountValue.discountType: 'FIXED_AMOUNT' | 'PERCENT'
طريقة تطبيق قيمة الخصم.
مثال: "FIXED_AMOUNT"
discountValue.value: number
قيمة الخصم (بوحدات العملة لـ FIXED_AMOUNT، وبنقاط مئوية لـ PERCENT).
مثال: 10
discountValue.maxAmount: number | null
الحد الأقصى للخصم المطلق المطبق، أو null عند عدم وجود حد.
مثال: 5
conditionLogic: string
طريقة دمج الشروط: AND أو OR.
conditions: IDiscountCondition[]
شروط الخصم.
conditions.type: string
نوع شرط الخصم.
conditions.value: string
القيمة المرتبطة بشرط الخصم.
exclusions: Record<string, unknown> | null
استثناءات الخصم.
gifts: Record<string, unknown> | null
هدايا الخصم.
giftsReplaceCartItems: boolean
هل تحل الهدايا محل عناصر سلة التسوق.
userGroups: Record<string, unknown> | null
مجموعات المستخدمين التي ينطبق عليها الخصم.
userExclusions: Record<string, unknown> | null
المستخدمون المستبعدون من الخصم.
attributeValues: IAttributeValues
قيم سمات الخصم.
attributeSetIdentifier: string
علامة مجموعة السمات.
bonusEvent: Record<string, unknown>
إعدادات حدث المكافأة.
position: number
الموضع المستخدم للفرز.
مثال: 1
total: number | string
عدد صفوف داخلي يُرجعه API عن طريق الخطأ ("1" لخصم واحد). لا تعتمد عليه.
مثال: "1"
distance: number
مسافة جيب التمام إلى الاستعلام. تُرجعها نقطة نهاية البحث الدلالي (المتجهي) في كل عنصر.
مثال: 0.12