fix(dashboard, core-flows, medusa): prevent creation of empty fulfillments (#11664)
This commit is contained in:
@@ -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 })
|
||||
|
||||
Reference in New Issue
Block a user