- Get Started
- Product
- Resources
- Tools & SDKs
- Framework
- Reference
Menu
- Get Started
- Product
- Resources
- Tools & SDKs
- Framework
- Reference
createPromotions - Promotion Module Reference
This documentation provides a reference to the createPromotions
method. This belongs to the Promotion Module.
Note: You should only use this methods when implementing complex customizations. For common cases, check out available workflows instead.
createPromotions(data, sharedContext?): Promise<PromotionDTO[]>#
This method creates promotions.
Example#
1const promotions = await promotionModuleService.createPromotions([2 {3 code: "50OFF",4 type: "standard",5 application_method: {6 type: "percentage",7 target_type: "items",8 value: 50,9 },10 },11 {12 code: "FREESHIPPING",13 type: "standard",14 application_method: {15 type: "percentage",16 target_type: "shipping_methods",17 value: 100,18 },19 },20 {21 code: "BUY2GET1",22 type: "buyget",23 application_method: {24 type: "fixed",25 target_type: "items",26 buy_rules_min_quantity: 2,27 apply_to_quantity: 1,28 buy_rules: [29 {30 attribute: "SKU",31 operator: "eq",32 values: ["SHIRT"],33 },34 ],35 },36 },37])
Parameters#
data
CreatePromotionDTO[]The promotions to be created.
data
CreatePromotionDTO[]Returns#
Promise
Promise<PromotionDTO[]>The created promotions.
Promise
Promise<PromotionDTO[]>createPromotions(data, sharedContext?): Promise<PromotionDTO>#
This method creates a promotion.
Example#
1const promotionA = await promotionModuleService.createPromotions({2 code: "50OFF",3 type: "standard",4 application_method: {5 type: "percentage",6 target_type: "items",7 value: 50,8 },9})10 11const promotionB = await promotionModuleService.createPromotions({12 code: "FREESHIPPING",13 type: "standard",14 application_method: {15 type: "percentage",16 target_type: "shipping_methods",17 value: 100,18 },19})20 21const promotionC = await promotionModuleService.createPromotions({22 code: "BUY2GET1",23 type: "buyget",24 application_method: {25 type: "fixed",26 target_type: "items",27 buy_rules_min_quantity: 2,28 apply_to_quantity: 1,29 buy_rules: [30 {31 attribute: "SKU",32 operator: "eq",33 values: ["SHIRT"],34 },35 ],36 },37})
Parameters#
The promotion to be created.
Returns#
Promise
Promise<PromotionDTO>The created promotion.
Promise
Promise<PromotionDTO>Was this page helpful?