File tree Expand file tree Collapse file tree 3 files changed +41
-3
lines changed Expand file tree Collapse file tree 3 files changed +41
-3
lines changed Original file line number Diff line number Diff line change 1+ <?php
2+ /**
3+ * Copyright 2025 Adobe
4+ * All Rights Reserved.
5+ */
6+ declare (strict_types=1 );
7+
8+ namespace Magento \Paypal \Plugin ;
9+
10+ use Magento \Quote \Model \CustomerManagement ;
11+ use Magento \Quote \Model \Quote as QuoteEntity ;
12+ use Magento \Paypal \Model \Config as PaymentMethodConfig ;
13+ use Magento \Framework \Validator \Exception as ValidatorException ;
14+
15+ /**
16+ * Skip billing address validation for PayPal payment method
17+ */
18+ class CustomerManagementPlugin
19+ {
20+ /**
21+ * Around plugin for the validateAddresses method
22+ *
23+ * @param CustomerManagement $subject
24+ * @param \Closure $proceed
25+ * @param QuoteEntity $quote
26+ * @return void
27+ * @throws ValidatorException
28+ */
29+ public function aroundValidateAddresses (CustomerManagement $ subject , \Closure $ proceed , QuoteEntity $ quote )
30+ {
31+ if ($ quote ->getCustomerIsGuest () &&
32+ in_array ($ quote ->getPayment ()->getMethod (), PaymentMethodConfig::PAYMENT_METHODS_SKIP_ADDRESS_VALIDATION )) {
33+ return ;
34+ }
35+ $ proceed ($ quote );
36+ }
37+ }
Original file line number Diff line number Diff line change 269269 </argument >
270270 </arguments >
271271 </type >
272+ <type name =" Magento\Quote\Model\CustomerManagement" >
273+ <plugin name =" paypal_payment_skip_addresses_validate" type =" Magento\Paypal\Plugin\CustomerManagementPlugin" />
274+ </type >
272275</config >
Original file line number Diff line number Diff line change 1616use Magento \Framework \Validator \Exception as ValidatorException ;
1717use Magento \Framework \Validator \Factory as ValidatorFactory ;
1818use Magento \Quote \Model \Quote as QuoteEntity ;
19- use Magento \Paypal \Model \Config as PaymentMethod ;
2019
2120/**
2221 * Class Customer
@@ -160,8 +159,7 @@ public function validateAddresses(QuoteEntity $quote)
160159 $ quote ->getShippingAddress ()->getCustomerAddressId ()
161160 );
162161 }
163- if (empty ($ addresses ) && $ quote ->getCustomerIsGuest () &&
164- !in_array ($ quote ->getPayment ()->getMethod (), PaymentMethod::PAYMENT_METHODS_SKIP_ADDRESS_VALIDATION )) {
162+ if (empty ($ addresses ) && $ quote ->getCustomerIsGuest ()) {
165163 $ billingAddress = $ quote ->getBillingAddress ();
166164 $ customerAddress = $ this ->customerAddressFactory ->create ();
167165 $ customerAddress ->setFirstname ($ billingAddress ->getFirstname ());
You can’t perform that action at this time.
0 commit comments