Skip to content

Commit a44eb5d

Browse files
committed
#17744 Adding logic to get default billing address
1 parent 6c529ec commit a44eb5d

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

app/code/Magento/Checkout/view/frontend/web/js/model/checkout-data-resolver.js

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,15 +219,26 @@ define([
219219
*/
220220
applyBillingAddress: function () {
221221
var shippingAddress;
222+
var isBillingAddressInitialized;
222223

223224
if (quote.billingAddress()) {
224225
selectBillingAddress(quote.billingAddress());
225226

226227
return;
227228
}
228-
shippingAddress = quote.shippingAddress();
229+
shippingAddress = quote.billingAddress();
230+
if(quote.isVirtual()) {
231+
isBillingAddressInitialized = addressList.some(function (addrs) {
232+
if (addrs.isDefaultBilling()) {
233+
selectBillingAddress(addrs);
234+
return true;
235+
}
236+
return false;
237+
});
238+
}
229239

230-
if (shippingAddress &&
240+
if (!isBillingAddressInitialized &&
241+
shippingAddress &&
231242
shippingAddress.canUseForBilling() &&
232243
(shippingAddress.isDefaultShipping() || !quote.isVirtual())
233244
) {

0 commit comments

Comments
 (0)