Skip to content

Commit 71db7d0

Browse files
committed
use list instead of retrieve by cart id to not get the totals that are not expected
1 parent aaba280 commit 71db7d0

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

packages/medusa/src/services/order.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -534,12 +534,14 @@ class OrderService extends TransactionBaseService {
534534
const cartServiceTx = this.cartService_.withTransaction(manager)
535535
const inventoryServiceTx = this.inventoryService_.withTransaction(manager)
536536

537-
const exists = !!(await this.retrieveByCartId(
538-
isString(cartOrId) ? cartOrId : cartOrId?.id,
539-
{
540-
select: ["id"],
541-
}
542-
))
537+
const exists = !!(
538+
await this.list(
539+
{ cart_id: isString(cartOrId) ? cartOrId : cartOrId?.id },
540+
{
541+
select: ["id"],
542+
}
543+
)
544+
).length
543545

544546
if (exists) {
545547
throw new MedusaError(

0 commit comments

Comments
 (0)