We are running into an issue in Checkout where the...
# suitecommerce
b
We are running into an issue in Checkout where there are multiple addresses and none is marked as default. We end up with an empty address. Has anyone had this issue? Is there a way to modify the model to mark my own default? I haven't been able to figure it out
l
But why default address is not being set?
On customer record..
b
It should be, and if we edit the customer record our problem is fixed. But somehow it is getting unset, and we would like to fix it without them having to call in
l
Copy code
setAddress: function (data, current_order){
    if (addresses.length > 1 && !_.find(addresses, function (address) { return address.get('isdefault') === 'T'; })) {
        // Set the first address as the default
        var firstAddress = <http://addresses.at|addresses.at>(0);
        firstAddress.set('isdefault', 'T');
    }
}
I might be wrong, But you could try setting default address, but do this using extending LiveOrder.Model.js, Not sure if this will work
b
Ok, thanks! I will give that a try
l
Copy code
_.extend(orderWizardModuleAddressInstance, {
                updateAddress: function()
                {
                    var addresses = this.wizard.model.get('addresses');
                    if (addresses.length > 1 && !_.find(addresses.models, function (address) { return address.get('isdefault') === 'T'; })) {
                        var firstAddress = <http://addresses.at|addresses.at>(0);
                        firstAddress.set('isdefault', 'T');
                    }
                }
            });
b
What is the reference to include it in my file?
efine( 'BYU.BYUAddressValidation.BYUAddressValidation' , [ 'BYU.BYUAddressValidation.BYUAddressValidation.View', ] , function ( BYUAddressValidationView, orderWizardModuleAddressInstance )