0

I need to get shipping price programatically. I thought I'd use something like this (inspiration):

$scopeConfig = $objectManager->get('\Magento\Framework\App\Config\ScopeConfigInterface');
$activeCarriers = $objectManager->create('Magento\Shipping\Model\Config')->getActiveCarriers();

foreach($activeCarriers as $carrierCode => $carrierModel) {
    $options = array();

    if ($carrierMethods = $carrierModel->getAllowedMethods()) {
        foreach ($carrierMethods as $methodCode => $method) {
            $code = $carrierCode.'_'.$methodCode;
            $options[] = array('value'=>$code,'label'=>$method);
        }
        $carrierTitle = $scopeConfig->getValue('carriers/' . $carrierCode . '/title');
    }

    $methods[] = array('value' => $options, 'label' => $carrierTitle);
}

But that does not help much, because I know which shipping methods I'm using. I just need to know details of WebShopApps Matrix Rate which has been saved in webshopapps_matrixrate table. I.E. I need just the content of the SQL:

select * from webshopapps_matrixrate where website_id = ID;

I also see records with path = carriers/matrixrate/import in core_config_data, but that does not help much (value = 1590180257,matrixrates.csv,text/csv,/tmp/php7BEvw0,0,361).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.