File tree Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -607,6 +607,25 @@ class Config extends AbstractConfig
607607 */
608608 protected $ cspNonceProvider ;
609609
610+ /**
611+ * Payment methods to skip address validation
612+ */
613+ public const PAYMENT_METHODS_SKIP_ADDRESS_VALIDATION = [
614+ self ::METHOD_EXPRESS ,
615+ self ::METHOD_WPS_EXPRESS ,
616+ self ::METHOD_WPS_BML ,
617+ self ::METHOD_WPP_BML ,
618+ self ::METHOD_WPP_DIRECT ,
619+ self ::METHOD_PAYMENT_PRO ,
620+ self ::METHOD_WPP_PE_EXPRESS ,
621+ self ::METHOD_WPP_PE_BML ,
622+ self ::METHOD_PAYFLOWPRO ,
623+ self ::METHOD_PAYFLOWLINK ,
624+ self ::METHOD_PAYFLOWADVANCED ,
625+ self ::METHOD_HOSTEDPRO ,
626+ self ::METHOD_BILLING_AGREEMENT
627+ ];
628+
610629 /**
611630 * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
612631 * @param \Magento\Directory\Helper\Data $directoryHelper
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 ;
1920
2021/**
2122 * Class Customer
@@ -159,7 +160,8 @@ public function validateAddresses(QuoteEntity $quote)
159160 $ quote ->getShippingAddress ()->getCustomerAddressId ()
160161 );
161162 }
162- if (empty ($ addresses ) && $ quote ->getCustomerIsGuest ()) {
163+ if (empty ($ addresses ) && $ quote ->getCustomerIsGuest () &&
164+ !in_array ($ quote ->getPayment ()->getMethod (), PaymentMethod::PAYMENT_METHODS_SKIP_ADDRESS_VALIDATION )) {
163165 $ billingAddress = $ quote ->getBillingAddress ();
164166 $ customerAddress = $ this ->customerAddressFactory ->create ();
165167 $ customerAddress ->setFirstname ($ billingAddress ->getFirstname ());
You can’t perform that action at this time.
0 commit comments