medusa
medusa copied to clipboard
[Bug] "Paid Total" is is incorrect if the order contains deleted discounts
Bug report
Describe the bug
paid_total will be less then total, if order has a discounts which is soft deleted
System information
Medusa version :1.20.1
Steps to reproduce the behavior
- Create the order from the cart with discount
- Delete the discount
- Compare paid_total with total
Solution: inside OrderRepository
const ITEMS_REL_NAME = "items"
const REGION_REL_NAME = "region"
const DISCOUNTS_REL_NAME = "discounts"
const WITH_DELETED_REL_NAMES = [
ITEMS_REL_NAME,
REGION_REL_NAME,
DISCOUNTS_REL_NAME
]
return this.find({
withDeleted: WITH_DELETED_REL_NAMES.includes(topLevel),
})
Nice catch, would you be up for sending a PR with the fix + test?
@olivermrbl we ran into this issue as well, I opened a PR with the fix (https://github.com/medusajs/medusa/pull/6837)
Thanks @pepijn-vanvlaanderen, will be part of next release.