Hi Guys, Is there a way to unset the default billi...
# suitecommerce
c
Hi Guys, Is there a way to unset the default billing and shipping address in the customer record on selection of the selected shipping or billing address?
k
We customized that before. Don't think there is any config.
I didn't make the change myself, sorry. We primarily changed it because we are not allowing the shopper to change the default billing address and that behavior is a loophole.
c
Hi @PabloZ Do you have any Idea on this behavior?
p
The behavior of SiteBuilder and SCA with default addresses and also shipping method is indeed annoying and cannot be turned off. There are workarounds like storing the previous value and setting it back after purchase or inactivity, or just create new "default" fields and read from them instead of the OOTB ones. But they are all hacks.
c
Yes true. But the behavior is not only depends on the purchase. If I try to add any new address It is saving as default billing and shipping addresses in the customer record. And also If we select any of the address in the checkout and that address is setting as default shipping and billing addresses in the customer record. Is there a way can manipulate the default shipping and billing addresses in the customer record. I need to set the default billing and shipping address when the user enters his first address and doesn't change for other addresses on selection or while creating new addresses
p
that's why i said "purchase or inactivity" heh.. i'm aware it's changed when you chose the address, even if you don't do a purchase.
You can't avoid NS behavior, sorry, the behavior is done by the commerce api so it's not JS code you can change.
c
Sure @PabloZ Can I do that manipulation in Liveorder model or Profile model ?
when I try to see in the networks tab liveorderservice is triggering but not profile model
p
When you select an address it automatically gets selected behind the scenes as default address too.
and btw, that change doesn't trigger a user event in the customer record either
c
Thanks for the valuable information. Is there any workaround for this?
j
You can achieve it by tinkering around with OrderWizard’s Address (And it’s inherited classes “Shipping and Billing”) modules. These modules have a SetAddress function which in turn sets ‘billaddress’ and ‘shipaddress’ in the LiveOrder Model.
By extending or overriding these functions we’ve achieved something similar to what you’re looking for
c
Hi @James, Thanks for the response. I have looked into that module but it only sending the parameter as a Id to set the address but not individual parameters like billing, shipping, zip etc.
setAddress: function(address_id, options) { this.model.setAddress(this.manage, address_id, options); this.addressId = address_id; return this; },
j
Yes, but see this.model is a LiveOrder model
And if you look, it has its own function which sets “billaddress” or “shipaddress” to the model.
this.manage specifies that you’re either setting “billaddress” or “shipaddress”
c
Yes correct.
I will check whether there is a function exists in the this.model that sets the default billing and shipping address.
j
LiveOrderModel.setAddress() does that
It changes the models directly with Backbone Model’s set function
c
Sure. Can we manipulate only default shipping and billing paramaters from this function ? Do you have any Idea that we need to pass mandatory parameters?
j
Well, it actually sets those addresses for the Sales Order
c
But I'm looking for the addresses book in the customer record
j
But behind the scenes, as @PabloZ mentioned, the Commerce API is performing the default behaviour that you’re wanting to change.
c
Can't we manipulate this behavior @James ?
like triggering a suitelet and removing the default shipping and billing addresses
j
you could, I guess, but again it’s just circumventing default behaviour in whatever way you decide
c
Thanks @James I will try once
👍 1