1

I'm currently working on a custom shipping method for Magento 2 and I'm facing a problem : I don't know how to retrieve the shipping address.

I tried first with something like this in the collectRates method :

$city = $request->getDestCity();
$street = $request->getDestStreet();

But it didn't worked ($city and $street are empty).

That's strange because I don't have any issue whit the getDestPostcode() method.

Is there a another way to retrieve the shipping address ?

Thanks.

  • I think it might be a bug. – cdauphin Feb 29 '16 at 9:46
  • facing same issue need shipping address in collectRates – Pradeep Singh Apr 7 '16 at 7:26
0

This is a bug, see the following link on github: issue 3789

Basically the additional address fields need to be added to the payload within:

module-checkout/view/frontend/web/model/js/shipping-rate-processor/new-address.js

Also, you'll need to create another serviceUrl that will call a function that will hold the full address payload and adds the full address to the request.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.