0

How to get value from quote_address table for checkout and cart page in Magento2. Need values for guest and login user both in Magento2 cart and checkout page

1 Answer 1

1

If you have quote object.

You can access quote_address data like:

echo $quote->getBillingAddress()->getId(); // billing address id
echo $quote->getBillingAddress()->getEmail();
echo $quote->getShippingAddress()->getId(); // shipping address id
echo $quote->getShippingAddress()->getShippingMethod();

If you have $quoteId

protected $quoteRepository;

public function __construct(
    ...
    \Magento\Quote\Api\CartRepositoryInterface $quoteRepository,
    ....
) {
    ....
    $this->quoteRepository = $quoteRepository;
    ....
}

then can get quote by:

$quote = $this->quoteRepository->get($quoteId);
2
  • It is working thanks Dec 25, 2021 at 17:04
  • welcome @Webdeveloper :)
    – Pawan
    Dec 27, 2021 at 3:59

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.