Skip to content

Commit 298e404

Browse files
author
Vitaliy Boyko
committed
GraphQl-903: use_for_shipping backward compatibility
1 parent 5dd4a10 commit 298e404

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

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

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,14 @@ public function execute(ContextInterface $context, CartInterface $cart, array $b
5656
{
5757
$customerAddressId = $billingAddressInput['customer_address_id'] ?? null;
5858
$addressInput = $billingAddressInput['address'] ?? null;
59-
$sameAsshipping = isset($billingAddressInput['same_as_shipping'])
59+
$sameAsShipping = isset($billingAddressInput['same_as_shipping'])
6060
? (bool)$billingAddressInput['same_as_shipping'] : false;
6161

62+
if (!isset($billingAddressInput['same_as_shipping'])) {
63+
$sameAsShipping = isset($billingAddressInput['use_for_shipping'])
64+
? (bool)$billingAddressInput['use_for_shipping'] : false;
65+
}
66+
6267
if (null === $customerAddressId && null === $addressInput) {
6368
throw new GraphQlInputException(
6469
__('The billing address must contain either "customer_address_id" or "address".')
@@ -72,15 +77,15 @@ public function execute(ContextInterface $context, CartInterface $cart, array $b
7277
}
7378

7479
$addresses = $cart->getAllShippingAddresses();
75-
if ($sameAsshipping && count($addresses) > 1) {
80+
if ($sameAsShipping && count($addresses) > 1) {
7681
throw new GraphQlInputException(
7782
__('Using the "same_as_shipping" option with multishipping is not possible.')
7883
);
7984
}
8085

8186
$billingAddress = $this->createBillingAddress($context, $customerAddressId, $addressInput);
8287

83-
$this->assignBillingAddressToCart->execute($cart, $billingAddress, $sameAsshipping);
88+
$this->assignBillingAddressToCart->execute($cart, $billingAddress, $sameAsShipping);
8489
}
8590

8691
/**

0 commit comments

Comments
 (0)