我如何获得当前选定的发货地址Id magnet 2.3.4



我想在结账页面上获得选定的发货id。

$objectManager = MagentoFrameworkAppObjectManager::getInstance();
//$cart = $objectManager->get('MagentoCheckoutModelCart'); 
$session = $objectManager->get('MagentoCheckoutModelSession');
$quote = $session->getQuote();
$shippingMethod = $quote->getShippingAddress();
echo $addressId = $shippingMethod->getCustomerAddressId();

我试图获得发货地址id,但当我从结账时更改下面的图像时,它总是给出保存idhttps://drive.google.com/file/d/11N3SBaahNlugWzMw2ySAZHn4Yh4kQ64q/view

它不会改变运输id显示相同。如何获取当前选定的发货地址Id?

protected $quoteRepository;
public function __construct (
MagentoQuoteApiCartRepositoryInterface $quoteRepository,
) {
$this->quoteRepository = $quoteRepository;
}
$quote = $this->quoteRepository->get($quoteId);
$addressId = $quote->getCustomerAddressId();

相关内容

  • 没有找到相关文章

最新更新