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

getDiscountByMarker

الحصول على كائن خصم واحد بواسطة معرفه النصي (المؤشر).

الوصف

تسترجع هذه الطريقة كائن خصم واحد بواسطة معرفه النصي (المؤشر). تعيد Promise التي تحل إلى كائن IDiscountEntity.

الخصومات.getDiscountByMarker(

marker*, langCode

);

مخطط المعلمات

المخطط

marker(مطلوب): string
المعرف النصي لكائن تخزين الخصم
مثال: "discount_storage"

langCode: string
رمز اللغة. الافتراضي: "en_US"
مثال: "en_US"

أمثلة

مثال بسيط

const response = await Discounts.getDiscountByMarker('summer_sale');

مثال مع السمات

const response = await Discounts.getDiscountByMarker('summer_sale', '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": [],
"position": 1
}

مخطط الاستجابة

المخطط: IDiscountsEntity

id: number
المعرف الفريد للخصم.

attributeSetId: number
معرف الخصم.

localizeInfos: object
اسم الخصم.

version: number
إصدار الخصم.

identifier: string
معرف الخصم.

type: string
نوع الخصم.

startDate: string
تاريخ بدء الخصم.

endDate: string
تاريخ انتهاء الخصم.

discountValue: Record<string, unknown>
قيمة الخصم.

conditionLogic: string
منطق الخصم. القيم الممكنة هي "AND" | "OR".

conditions: IDiscountCondition[]
شروط الخصم.

conditions.type: string
نوع شرط الخصم.

conditions.value: string
القيمة المرتبطة بشرط الخصم.

exclusions: object
استثناءات الخصم.

gifts: object
الهدايا المرتبطة بالخصم.

giftsReplaceCartItems: boolean
ما إذا كانت الهدايا تحل محل عناصر السلة.

userGroups: object
مجموعات المستخدمين المرتبطة بالخصم.

userExclusions: object
استثناءات المستخدمين المرتبطة بالخصم.

attributeValues: object
قيم السمات المرتبطة بالخصم.

attributeSetIdentifier: string
معرف مجموعة السمات.