File tree Expand file tree Collapse file tree 5 files changed +43
-0
lines changed
app/code/Magento/Checkout
view/frontend/web/js/model Expand file tree Collapse file tree 5 files changed +43
-0
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,8 @@ interface ShippingInformationInterface extends \Magento\Framework\Api\CustomAttr
12
12
*/
13
13
const SHIPPING_ADDRESS = 'shipping_address ' ;
14
14
15
+ const BILLING_ADDRESS = 'billing_address ' ;
16
+
15
17
const SHIPPING_METHOD_CODE = 'shipping_method_code ' ;
16
18
17
19
const SHIPPING_CARRIER_CODE = 'shipping_carrier_code ' ;
@@ -33,6 +35,21 @@ public function getShippingAddress();
33
35
*/
34
36
public function setShippingAddress (\Magento \Quote \Api \Data \AddressInterface $ address );
35
37
38
+ /**
39
+ * Returns billing address
40
+ *
41
+ * @return \Magento\Quote\Api\Data\AddressInterface|null
42
+ */
43
+ public function getBillingAddress ();
44
+
45
+ /**
46
+ * Set billing address if additional synchronization needed
47
+ *
48
+ * @param \Magento\Quote\Api\Data\AddressInterface $address
49
+ * @return $this
50
+ */
51
+ public function setBillingAddress (\Magento \Quote \Api \Data \AddressInterface $ address );
52
+
36
53
/**
37
54
* Returns shipping method code
38
55
*
Original file line number Diff line number Diff line change @@ -29,6 +29,22 @@ public function setShippingAddress(\Magento\Quote\Api\Data\AddressInterface $add
29
29
return $ this ->setData (self ::SHIPPING_ADDRESS , $ address );
30
30
}
31
31
32
+ /**
33
+ * {@inheritdoc}
34
+ */
35
+ public function getBillingAddress ()
36
+ {
37
+ return $ this ->getData (self ::BILLING_ADDRESS );
38
+ }
39
+
40
+ /**
41
+ * {@inheritdoc}
42
+ */
43
+ public function setBillingAddress (\Magento \Quote \Api \Data \AddressInterface $ address )
44
+ {
45
+ return $ this ->setData (self ::BILLING_ADDRESS , $ address );
46
+ }
47
+
32
48
/**
33
49
* {@inheritdoc}
34
50
*/
Original file line number Diff line number Diff line change @@ -128,6 +128,10 @@ public function saveAddressInformation(
128
128
$ addressData = $ this ->addressRepository ->getById ($ customerAddressId );
129
129
$ address = $ quote ->getShippingAddress ()->importCustomerAddressData ($ addressData );
130
130
}
131
+ $ billingAddress = $ addressInformation ->getBillingAddress ();
132
+ if ($ billingAddress ) {
133
+ $ quote ->setBillingAddress ($ billingAddress );
134
+ }
131
135
132
136
$ address ->setSaveInAddressBook ($ saveInAddressBook );
133
137
$ address ->setSameAsBilling ($ sameAsBilling );
Original file line number Diff line number Diff line change @@ -172,6 +172,10 @@ define([
172
172
}
173
173
} ,
174
174
applyBillingAddress : function ( ) {
175
+ if ( quote . billingAddress ( ) ) {
176
+ selectBillingAddress ( quote . billingAddress ( ) ) ;
177
+ return ;
178
+ }
175
179
var shippingAddress = quote . shippingAddress ( ) ;
176
180
if ( shippingAddress
177
181
&& shippingAddress . canUseForBilling ( )
Original file line number Diff line number Diff line change @@ -27,9 +27,11 @@ define(
27
27
'use strict' ;
28
28
return {
29
29
saveShippingInformation : function ( ) {
30
+ var billingAddress = quote . billingAddress ( ) || quote . shippingAddress ( ) ;
30
31
var payload = {
31
32
addressInformation : {
32
33
shipping_address : quote . shippingAddress ( ) ,
34
+ billing_address : billingAddress ,
33
35
shipping_method_code : quote . shippingMethod ( ) . method_code ,
34
36
shipping_carrier_code : quote . shippingMethod ( ) . carrier_code
35
37
}
You can’t perform that action at this time.
0 commit comments