Hi I have a custom module . I want to get shipping country inside
public function execute(MagentoFrameworkEventObserver $observer)
{
Please let me know how can i get this this ?
I have seen this code for postcode , but i am not sure his is working or not
$postCode = $this->_checkoutSession->getQuote()-getShippingAddress()->getPostcode();
I need shipping address country name in public function execute. Please help .
2
Answers
declare a public variable and intialize the variable like below ,then you will be able to use it in your execute method
It depends on which observer do you want to get it. Can you provide a more specific scenario?
In which checkout session currently has a quote. You can use the above solution from Reggie.
Or else you need to initialize quote/order to get it.