从aroundCollectRates访问运费

时间:2019-07-17 15:20:39

标签: magento2 shipping

我(成功地认为)正在使用aroundCollectRates重写我正在使用的不同承运人要求的运费的方式。

我还要重写collectCarrierRates,因为我不需要像composePackagesForCarrier这样的进程。我直接进入$ carrier-> collectRates($ request),因为$ request现在包含一些我要在around函数中添加的额外信息。

我的问题是:我如何访问与运费响应相关的信息?我可以在“结帐页面”中查看价格,但是对于我一生来说,我不知道该信息位于何处。 enter image description here

这是我设置环绕功能的方法:

public function aroundCollectRates(Shipping $shipping, callable $proceed, RateRequest $request) {
    // All the original stuff goes here, then...
    foreach ($carriers as $carrierCode => $carrierConfig) {
        $this->collectCarrierRates($carrierCode, $request);
    }
}

关于$ shipping,我想显示的是空的。

非常感谢。

0 个答案:

没有答案