fix(dashboard, core-flows, medusa): prevent creation of empty fulfillments (#11664)

This commit is contained in:
Frane Polić
2025-03-03 17:54:20 +01:00
committed by GitHub
parent 40a9cffb34
commit e23f204b7c
4 changed files with 31 additions and 10 deletions

View File

@@ -83,6 +83,13 @@ export type CreateFulfillmentValidateOrderStepInput = {
export const createFulfillmentValidateOrder = createStep(
"create-fulfillment-validate-order",
({ order, inputItems }: CreateFulfillmentValidateOrderStepInput) => {
if (!inputItems.length) {
throw new MedusaError(
MedusaError.Types.INVALID_DATA,
"No items to fulfill"
)
}
throwIfOrderIsCancelled({ order })
throwIfItemsDoesNotExistsInOrder({ order, inputItems })
throwIfItemsAreNotGroupedByShippingRequirement({ order, inputItems })