From 4e23a908f2c098f0f44ff0f020971af6617073bf Mon Sep 17 00:00:00 2001 From: Matteo Alessani Date: Mon, 19 Feb 2024 18:23:48 +0100 Subject: [PATCH] fix: use customer address in address reference --- components/data/AppProvider/utils.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/components/data/AppProvider/utils.ts b/components/data/AppProvider/utils.ts index 0120535b2..319719cfa 100644 --- a/components/data/AppProvider/utils.ts +++ b/components/data/AppProvider/utils.ts @@ -154,10 +154,10 @@ export async function checkAndSetDefaultAddressForOrder({ // Set reference on original address if not present // doing this we can lookup the cloned address for the same entity - if (address.id && address.reference !== address.id) { + if (address.id && address.reference !== customerAddresses[0].id) { await cl.addresses.update({ id: address.id, - reference: address.id, + reference: customerAddresses[0].id, }) } @@ -186,7 +186,7 @@ export async function checkAndSetDefaultAddressForOrder({ customerAddresses: [ { ...customerAddresses[0], - address: { ...address, reference: address.id }, + address: { ...address, reference: customerAddresses[0].id }, }, ], hasSameAddresses: true,