File tree Expand file tree Collapse file tree 1 file changed +11
-6
lines changed Expand file tree Collapse file tree 1 file changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -181,19 +181,24 @@ public function getResponseContactId()
181181 /**
182182 * Retrieve customer address
183183 *
184- * @param \Magento\Customer\Model\Customer $customer
184+ * @param \Magento\Customer\Model\Customer|\Magento\Customer\Model\Data\Customer $customer
185185 * @return array|mixed|bool
186186 */
187187 protected function _getCustomerAddress ($ customer )
188188 {
189189 $ address = false ;
190- if ($ customer ->getPrimaryBillingAddress ()) {
191- $ address = $ customer ->getPrimaryBillingAddress ();
192- } elseif ($ customer ->getPrimaryShippingAddress ()) {
193- $ address = $ customer ->getPrimaryShippingAddress ();
194- } elseif ($ customer ->getAddresses ()) {
190+ if ($ customer instanceof \Magento \Customer \Model \Data \Customer) {
195191 $ addresses = $ customer ->getAddresses ();
196192 $ address = array_shift ($ addresses );
193+ } else {
194+ if ($ customer ->getPrimaryBillingAddress ()) {
195+ $ address = $ customer ->getPrimaryBillingAddress ();
196+ } elseif ($ customer ->getPrimaryShippingAddress ()) {
197+ $ address = $ customer ->getPrimaryShippingAddress ();
198+ } elseif ($ customer ->getAddresses ()) {
199+ $ addresses = $ customer ->getAddresses ();
200+ $ address = array_shift ($ addresses );
201+ }
197202 }
198203
199204 if ($ address ) {
You can’t perform that action at this time.
0 commit comments