1- import {
2- ApplicationMethodAllocationValues ,
3- BigNumberInput ,
4- PromotionTypes ,
5- } from "@medusajs/framework/types"
1+ import { ApplicationMethodAllocationValues , BigNumberInput , PromotionTypes , } from "@medusajs/framework/types"
62import {
73 ApplicationMethodAllocation ,
84 ApplicationMethodTargetType ,
@@ -45,9 +41,7 @@ export function getComputedActionsForItems(
4541
4642function applyPromotionToItems (
4743 promotion : PromotionTypes . PromotionDTO ,
48- items :
49- | PromotionTypes . ComputeActionContext [ TargetType . ITEMS ]
50- | PromotionTypes . ComputeActionContext [ TargetType . SHIPPING_METHODS ] ,
44+ items : PromotionTypes . ComputeActionContext [ TargetType . ITEMS ] ,
5145 appliedPromotionsMap : Map < string , BigNumberInput > ,
5246 allocationOverride ?: ApplicationMethodAllocationValues
5347) : PromotionTypes . ComputeActions [ ] {
@@ -72,13 +66,10 @@ function applyPromotionToItems(
7266 return computedActions
7367 }
7468
75- const isTargetShippingMethod = target === TargetType . SHIPPING_METHODS
7669 const isTargetLineItems = target === TargetType . ITEMS
7770 const isTargetOrder = target === TargetType . ORDER
7871 const promotionValue = applicationMethod ?. value ?? 0
79- const maxQuantity = isTargetShippingMethod
80- ? 1
81- : applicationMethod ?. max_quantity !
72+ const maxQuantity = applicationMethod ?. max_quantity !
8273
8374 let lineItemsAmount = MathBN . convert ( 0 )
8475 if ( allocation === ApplicationMethodAllocation . ACROSS ) {
@@ -109,10 +100,6 @@ function applyPromotionToItems(
109100 continue
110101 }
111102
112- if ( isTargetShippingMethod ) {
113- item . quantity = 1
114- }
115-
116103 const appliedPromoValue = appliedPromotionsMap . get ( item . id ) ?? 0
117104
118105 const amount = calculateAdjustmentAmountFromPromotion (
@@ -152,13 +139,6 @@ function applyPromotionToItems(
152139 code : promotion . code ! ,
153140 is_tax_inclusive : promotion . is_tax_inclusive ,
154141 } )
155- } else if ( isTargetShippingMethod ) {
156- computedActions . push ( {
157- action : ComputedActions . ADD_SHIPPING_METHOD_ADJUSTMENT ,
158- shipping_method_id : item . id ,
159- amount,
160- code : promotion . code ! ,
161- } )
162142 }
163143 }
164144
0 commit comments