I am working on shopping cart custom shipping method. I am using the following link http://inchoo.net/magento-2/creating-a-shipping-method-in-magento-2/.

estimate-shipping-method ajax call having region_id and I need that value inside collectRates() method.

3 Answers 3


If you var_dump($request->getData()) you will see that there are all details available in it. To get region_id simply use,

$regionId = $request->getData('region_id');

I found solution for it.


It gives the region id.

$data = json_decode(file_get_contents('php://input'), true);
$region = $data['region_id'];

this is uncommon way, but it works

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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