Is there a way to prevent a customer's default shi...
# suitecommerce
c
Is there a way to prevent a customer's default shipping and/or billing address from changing when an address selection is made in checkout? Currently, when a user goes through the checkout process and chooses an address that is not the default address, that address is updated to become the default address. This occurs before the order is even submitted.
From what I can tell, it appears to be the result of the front-end LiveOrder.Model being updated to reflect the new address selection. However, the selected address is labeled as the default, even if it is not. The LiveOrder.Service is called to sync the front-end and back-end models, which then appears to update the address record in the back-office by labeling it as the default.
p
This has been discussed a few times in this website, it's a shame it's most likely lost
The code that makes the address you picked for shipping as the default shipping address is not on SCA code
it's something that Commerce API does behind the scenes for you and AFAIK the behavior cannot be overriden.
There are only ugly and less-than-perfect workarounds.
c
Thank you for the insight, @PabloZ. I was hoping that it wasn't a result of the setAddress method of the Commerce API, but it sounds like that is the case, which makes sense, considering I was unable to find anything in the SCA code that mimicked this behavior.
I assume the workarounds involve a back-office SuiteScript solution?
p
I know 2 different approaches: Approach 1) Use another customer field for the real default shipping address field and make whatever you need to read real default address read it (like transactions with shipping) Approach 2) Before setting the ship address in sca, store what was the default address id in a custom field. Then have 2 scripts: 2.1) so after order placement revert default address back to the previous one 2.2) one scheduled/ M/R script that after X time of session inactivity it also reverts it to the default one.
both approaches are less than optimal.
c
I see what you mean. The first approach could possibly work for our situation, though it's not ideal. I appreciate your help.
👍🏽 1
w
Interesting workaround , We encountered similar behavior with the default address