feat(medusa): Improve addShippingMethod on store cart route (#3222)

This commit is contained in:
Adrien de Peretti
2023-02-09 16:55:40 +01:00
committed by GitHub
parent 507ad00bec
commit 6e443dc708
3 changed files with 7 additions and 5 deletions

View File

@@ -0,0 +1,5 @@
---
"@medusajs/medusa": patch
---
chore(medusa): Improve addShippingMethod on store cart route to use new totals calculation algo

View File

@@ -80,6 +80,7 @@ export default async (req, res) => {
)
const updated = await txCartService.retrieve(id, {
select: ["id"],
relations: ["payment_sessions"],
})

View File

@@ -2072,16 +2072,12 @@ class CartService extends TransactionBaseService {
): Promise<Cart> {
return await this.atomicPhase_(
async (transactionManager: EntityManager) => {
const cart = await this.retrieve(cartId, {
select: ["subtotal", "total"],
const cart = await this.retrieveWithTotals(cartId, {
relations: [
"shipping_methods",
"discounts",
"discounts.rule",
"shipping_methods.shipping_option",
"items",
"items.variant",
"payment_sessions",
"items.variant.product",
],
})