We are running CE 2.1.2
Magento 2 sets the residential flag in the rates to request based on the configuration data. This means that all quotes are either residential or commercial, depending on what you set in the shipping method.
I want to set the flag based on if the Destination Address has a Company set or not.
What I did is go into /vendor/magento/module-fedex/Model/carrier.php
and change line 430 from
'Residential' => (bool)$this->getConfigData('residence_delivery'),
to
'Residential' => !empty(trim($r->getRecipientContactCompanyName())),
The is not working. Residential is false always. So empty must be returning true always.
Is the getRecipientContactCompanyName()
not the right way to get the Company name in this module? Any hints as to what I am doing wrong would be appreciated.