0

It appears the UPS integration inside Magento 2 does not include the declared value when calculating shipping quotes which can drastically make the quotes way off.

Anyone else experience this and find a way to have this included?

EDIT:

I found this module: https://github.com/xantek/magento2-ups-declared-value

However when DI Compiling, I receive this error;

Xantek\UpsDeclaredValue\Model\Carrier
Incompatible argument type: Required type: 
\Magento\Framework\HTTP\ClientFactory. Actual type: array; File:
/app/code/Xantek/UpsDeclaredValue/Model/Carrier.php

Total Errors Count: 1


[Magento\Framework\Validator\Exception]
Error during compilation
  • I think that the contractor of the Model is out of date with your Magento version – HoangHieu Oct 11 '18 at 15:16
  • @HoangHieu Is there any simple solution to that? – ne0nlight Oct 11 '18 at 15:29
1

Hi your used newest Magento version than the Module.

Magento 2.2.4 Ups Carrier Model __construct

public function __construct(
        \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig,
        \Magento\Quote\Model\Quote\Address\RateResult\ErrorFactory $rateErrorFactory,
        \Psr\Log\LoggerInterface $logger,
        Security $xmlSecurity,
        \Magento\Shipping\Model\Simplexml\ElementFactory $xmlElFactory,
        \Magento\Shipping\Model\Rate\ResultFactory $rateFactory,
        \Magento\Quote\Model\Quote\Address\RateResult\MethodFactory $rateMethodFactory,
        \Magento\Shipping\Model\Tracking\ResultFactory $trackFactory,
        \Magento\Shipping\Model\Tracking\Result\ErrorFactory $trackErrorFactory,
        \Magento\Shipping\Model\Tracking\Result\StatusFactory $trackStatusFactory,
        \Magento\Directory\Model\RegionFactory $regionFactory,
        \Magento\Directory\Model\CountryFactory $countryFactory,
        \Magento\Directory\Model\CurrencyFactory $currencyFactory,
        \Magento\Directory\Helper\Data $directoryData,
        \Magento\CatalogInventory\Api\StockRegistryInterface $stockRegistry,
        \Magento\Framework\Locale\FormatInterface $localeFormat,
        Config $configHelper,
        ClientFactory $httpClientFactory,
        array $data = []
    ) 

Change the module constructor like this code

Xantek\UpsDeclaredValue\Model\Carrier

public function __construct(
    \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig,
    \Magento\Quote\Model\Quote\Address\RateResult\ErrorFactory $rateErrorFactory,
    \Psr\Log\LoggerInterface $logger,
    Security $xmlSecurity,
    \Magento\Shipping\Model\Simplexml\ElementFactory $xmlElFactory,
    \Magento\Shipping\Model\Rate\ResultFactory $rateFactory,
    \Magento\Quote\Model\Quote\Address\RateResult\MethodFactory $rateMethodFactory,
    \Magento\Shipping\Model\Tracking\ResultFactory $trackFactory,
    \Magento\Shipping\Model\Tracking\Result\ErrorFactory $trackErrorFactory,
    \Magento\Shipping\Model\Tracking\Result\StatusFactory $trackStatusFactory,
    \Magento\Directory\Model\RegionFactory $regionFactory,
    \Magento\Directory\Model\CountryFactory $countryFactory,
    \Magento\Directory\Model\CurrencyFactory $currencyFactory,
    \Magento\Directory\Helper\Data $directoryData,
    \Magento\CatalogInventory\Api\StockRegistryInterface $stockRegistry,
    \Magento\Framework\Locale\FormatInterface $localeFormat,
    \Magento\Store\Model\StoreManagerInterface $storeManager,
    Config $configHelper,  
    \Magento\Framework\HTTP\ClientFactory $httpClientFactory, 
    array $data = []
) {
    $this->_storeManager = $storeManager;
    parent::__construct(
        $scopeConfig,
        $rateErrorFactory,
        $logger,
        $xmlSecurity,
        $xmlElFactory,
        $rateFactory,
        $rateMethodFactory,
        $trackFactory,
        $trackErrorFactory,
        $trackStatusFactory,
        $regionFactory,
        $countryFactory,
        $currencyFactory,
        $directoryData,
        $stockRegistry,
        $localeFormat,
        $configHelper,
        $httpClientFactory,
        $data
    );
}

Or just use auto-generation of IDE to generate the constructor.

  • Thank you for the help! I got another error now when trying to compile: [ReflectionException] Class Xantek\UpsDeclaredValue\Model\Magento\Framework\HTTP\ClientFactory does not exist -- [RuntimeException] Source class "\Xantek\UpsDeclaredValue\Model\Magento\Framework\HTTP\Client" for "Xantek\UpsDeclaredValue\Model\Magento\Framework \HTTP\ClientFactory" generation does not exist. – ne0nlight Oct 11 '18 at 16:56
  • Updated answer, I missed the "\" – HoangHieu Oct 11 '18 at 17:36
  • Thank you, everything works perfectly now! – ne0nlight Oct 11 '18 at 18:01

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.