fix(core-flows): cart complete order address creation (#12493)
* fix(core-flows): cart complete order address creation * fix(order): cascade delete addresses * fix: revert
This commit is contained in:
1 parent
2621f00bb0
commit
672871b733
2 files changed
+22
-2
No files matched your search
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
"@medusajs/core-flows": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
fix(core-flows): cart complete order address creation
|
||||||
@@ -225,6 +225,21 @@ export const completeCartWorkflow = createWorkflow(
|
|||||||
.map((adjustment) => adjustment.code)
|
.map((adjustment) => adjustment.code)
|
||||||
.filter(Boolean)
|
.filter(Boolean)
|
||||||
|
|
||||||
|
const shippingAddress = cart.shipping_address
|
||||||
|
? { ...cart.shipping_address }
|
||||||
|
: null
|
||||||
|
const billingAddress = cart.billing_address
|
||||||
|
? { ...cart.billing_address }
|
||||||
|
: null
|
||||||
|
|
||||||
|
if (shippingAddress) {
|
||||||
|
delete shippingAddress.id
|
||||||
|
}
|
||||||
|
|
||||||
|
if (billingAddress) {
|
||||||
|
delete billingAddress.id
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
region_id: cart.region?.id,
|
region_id: cart.region?.id,
|
||||||
customer_id: cart.customer?.id,
|
customer_id: cart.customer?.id,
|
||||||
@@ -232,8 +247,8 @@ export const completeCartWorkflow = createWorkflow(
|
|||||||
status: OrderStatus.PENDING,
|
status: OrderStatus.PENDING,
|
||||||
email: cart.email,
|
email: cart.email,
|
||||||
currency_code: cart.currency_code,
|
currency_code: cart.currency_code,
|
||||||
shipping_address: cart.shipping_address,
|
shipping_address: shippingAddress,
|
||||||
billing_address: cart.billing_address,
|
billing_address: billingAddress,
|
||||||
no_notification: false,
|
no_notification: false,
|
||||||
items: allItems,
|
items: allItems,
|
||||||
shipping_methods: shippingMethods,
|
shipping_methods: shippingMethods,
|
||||||
|
|||||||
Reference in new issue
Block a user