3
これは私のMagento 2を使用した最初のプロジェクトです。ログインした顧客のデフォルト請求/発送先住所を私のフロントエンドカスタムモジュール。ログインした顧客のデフォルトの請求先/配送先住所を取得Magento 2.0
これまでのところ、私はこれがあります。
//this gets the billing id which is an integer. I'm thinking it must be loaded to get the whole data of the address
$billingId = $customerSession->getCustomer()->getDefaultBilling();
//just found this in the internet and thought it might be the same as loading an order, but it doesn't work
$address = $objectManager->create('\Magento\Customer\Model\AddressFactory')->load($billingId);
をしかし、エラーは言う: Call to undefined method Magento\Customer\Model\AddressFactory::load()
私は近いですが、私は次に何をすべきか分からないと思います。前もって感謝します。
それは働きました!ありがとう! :D – Ian
オブジェクトマネージャを直接使用するのは良い習慣ではありません。 さらに、使用するアドレスの適切なリポジトリにする必要があります。 –
代わりに「間違った」方法を指摘してから、実際にどのように実装されるべきかの提案を書いてください。 – LefterisL