2

I created a observer and i need to fetch the zip code of current quote, Below code is for my event.xml

<event name="sales_quote_collect_totals_before">
<observer name="sipl_oda_observer_observer" instance="Sys\Oda\Observer\Observer" />
</event>

Code for Observer.php

$order= $observer->getData('order');
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
  • can you please share your module. I am also looking for the same. It would be more helpful for me. Thanks – Yudi Aug 20 '17 at 10:08
1

First of all, you can not get order object $order from this observer.

This observer only able to give u Quote Object mean Cart object

$this->eventManager->dispatch( 'sales_quote_collect_totals_before', ['quote' => $quote] );

So, At Observer files, you cab get Quote object

$quote = $observer->getEvent()->getQuote();

from this Quote object you can get Cart item details ,billing and shipping address,payments method details etc of a Cart

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.