Question

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.

Was it helpful?

Solution 2

I found solution for it.

$request->getDestRegionId();

It gives the region id.

OTHER TIPS

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');
$data = json_decode(file_get_contents('php://input'), true);
$region = $data['region_id'];

this is uncommon way, but it works

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top