Loading...
Was this page helpful?
This documentation provides a reference to the createPromotions
method. This belongs to the Promotion Module.
This method creates promotions.
1const promotions = await promotionModuleService.createPromotions([2 {3 code: "50OFF",4 type: "standard",5 status: "active",6 application_method: {7 type: "percentage",8 target_type: "items",9 value: 50,10 },11 },12 {13 code: "FREESHIPPING",14 type: "standard",15 status: "active",16 application_method: {17 type: "percentage",18 target_type: "shipping_methods",19 value: 100,20 },21 },22 {23 code: "BUY2GET1",24 type: "buyget",25 status: "active",26 application_method: {27 type: "fixed",28 target_type: "items",29 buy_rules_min_quantity: 2,30 apply_to_quantity: 1,31 buy_rules: [32 {33 attribute: "SKU",34 operator: "eq",35 values: ["SHIRT"],36 },37 ],38 },39 },40])
data
CreatePromotionDTO[]Promise
Promise<PromotionDTO[]>This method creates a promotion.
1const promotionA = await promotionModuleService.createPromotions({2 code: "50OFF",3 type: "standard",4 status: "active",5 application_method: {6 type: "percentage",7 target_type: "items",8 value: 50,9 },10})11 12const promotionB = await promotionModuleService.createPromotions({13 code: "FREESHIPPING",14 type: "standard",15 status: "active",16 application_method: {17 type: "percentage",18 target_type: "shipping_methods",19 value: 100,20 },21})22 23const promotionC = await promotionModuleService.createPromotions({24 code: "BUY2GET1",25 type: "buyget",26 status: "active",27 application_method: {28 type: "fixed",29 target_type: "items",30 buy_rules_min_quantity: 2,31 apply_to_quantity: 1,32 buy_rules: [33 {34 attribute: "SKU",35 operator: "eq",36 values: ["SHIRT"],37 },38 ],39 },40})
Promise
Promise<PromotionDTO>