【问题标题】:Custom shipping method - Physical store address in checkout?自定义送货方式 - 结帐时的实体店地址?
【发布时间】:2016-06-03 17:50:16
【问题描述】:

我正在研究一种自定义运输方式,我需要在 collectRates 方法中检索实体店地址以计算运输价格。

我设法以这种方式检索当前商店:

$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$storeManager = $objectManager->get('Magento\Store\Model\StoreManagerInterface');
$store = $storeManager->getStore();

不过好像不是实体店,只有网店。

有人知道如何检索地址、邮政编码和城市吗?

谢谢。

【问题讨论】:

    标签: php store checkout magento2


    【解决方案1】:

    好的,找到了。

    可能有人会感兴趣,所以我会在这里发布解决方案。

    您只需使用要检索的字段调用 getConfig 方法。

    为了检索街道地址第一行,你必须这样做:

    $store->getConfig('general/store_information/street_line1');
    

    您可以在magento github 上找到不同字段的列表

    【讨论】:

      猜你喜欢
      • 2015-07-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-04-22
      • 2011-09-23
      • 1970-01-01
      • 1970-01-01
      • 2013-02-28
      相关资源
      最近更新 更多