Skip to content

Commit 30eeb7f

Browse files
committed
graphQl-509: save_in_address_book has no impact on Address Book
1 parent 723039c commit 30eeb7f

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

app/code/Magento/QuoteGraphQl/Model/Cart/GetShippingAddress.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,11 @@ private function createShippingAddress(
9898
$shippingAddress = $this->quoteAddressFactory->createBasedOnInputData($addressInput);
9999

100100
// need to save address only for registered user and if save_in_address_book = true
101-
if (0 !== $customerId && !empty($addressInput['save_in_address_book'])) {
101+
if (
102+
0 !== $customerId
103+
&& isset($addressInput['save_in_address_book'])
104+
&& (bool)$addressInput['save_in_address_book'] === true
105+
) {
102106
$this->saveQuoteAddressToCustomerAddressBook->execute($shippingAddress, $customerId);
103107
}
104108
} else {

app/code/Magento/QuoteGraphQl/Model/Cart/SetBillingAddressOnCart.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,11 @@ private function createBillingAddress(
113113

114114
$customerId = $context->getUserId();
115115
// need to save address only for registered user and if save_in_address_book = true
116-
if (0 !== $customerId && !empty($addressInput['save_in_address_book'])) {
116+
if (
117+
0 !== $customerId
118+
&& isset($addressInput['save_in_address_book'])
119+
&& (bool)$addressInput['save_in_address_book'] === true
120+
) {
117121
$this->saveQuoteAddressToCustomerAddressBook->execute($billingAddress, $customerId);
118122
}
119123
} else {

0 commit comments

Comments
 (0)