Skip to content

Commit

Permalink
Update PaymentInformationManagement.php
Browse files Browse the repository at this point in the history
Added a check in the beforeSave function, this will break if the user doesnt have an default address in their profile... for whatever reason? anyway... :) Here you go!
  • Loading branch information
iriks-it authored Jun 29, 2023
1 parent 7e70bd2 commit 6122e96
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions Plugin/Magento/Checkout/Model/PaymentInformationManagement.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ class PaymentInformationManagement
*/
public function __construct(
Data $helper
) {
)
{
$this->helper = $helper;
}

Expand All @@ -38,17 +39,20 @@ public function __construct(
*/
public function beforeSavePaymentInformation(
\Magento\Checkout\Model\PaymentInformationManagement $subject,
$cartId,
PaymentInterface $paymentMethod,
AddressInterface $address
) {
$extAttributes = $address->getExtensionAttributes();
if (!empty($extAttributes)) {
$this->helper->transportFieldsFromExtensionAttributesToObject(
$extAttributes,
$address,
'extra_checkout_billing_address_fields'
);
$cartId,
PaymentInterface $paymentMethod,
AddressInterface $address = null
)
{
if ($address) {
$extAttributes = $address->getExtensionAttributes();
if (!empty($extAttributes)) {
$this->helper->transportFieldsFromExtensionAttributesToObject(
$extAttributes,
$address,
'extra_checkout_billing_address_fields'
);
}
}
}
}

0 comments on commit 6122e96

Please sign in to comment.