I'm having troubles with trying to get city_id extension attribute from a RateRequest object to use it with in_array PHP function, but I'm getting: Cannot use object of type Magento\Quote\Api\Data\AddressExtension as array
The thing is that I've a logger set and doing json_encode($request->getData()) returns the following JSON:
{"all_items":[{}],"dest_country_id":"CL","dest_region_id":913,"dest_region_code":"R02","dest_street":"","dest_city":"OLLAGUE","dest_postcode":"-","package_value":42990,"package_value_with_discount":42990,"package_weight":0.907,"package_qty":1,"extension_attributes":{"city_id":"903"},"package_physical_value":42990,"free_method_weight":0.907,"store_id":"1","website_id":"1","free_shipping":false,"base_currency":{},"package_currency":{},"limit_carrier":null,"base_subtotal_incl_tax":42990,"country_id":"CL","region_id":"809","city":null,"postcode":"83200"}
As you can see, there's city_id value on extension_attributes key, assuming json_encode return a string, I tried to get with $request['extension_attributes']['city_id'] but it's returning the error. How is that possible? I'm doing something wrong?
Thanks in advance!