I am trying to get Destination City in Collect rate Method of Magento 2

But its blank,

 * Collect and get rates
 * @param RateRequest $request
 * @return Result|bool|null
public function collectRates(\Magento\Quote\Model\Quote\Address\RateRequest $request)
    if ($request->getDestCity()) {
        echo $request->getDestCity();

Please Help me.


Magento by default does not include city field in rate request, So you should to rewrite EstimateAddressInterface and add city field.

| improve this answer | |

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.