Hi there
Thanks for the reading the question.
i want to add the guest checkout to my CRM system how to capture the guest checkout use data ?
Solved! Go to Solution.
If you want to use event suggested by me then you may use code like following.
public function execute(Observer $observer): void { $orderIds = $observer->getEvent()->getOrderIds(); $order = $observer->getEvent()->getOrder(); $lastOrderId = $orderIds['0']; // Your code logic here }
Thanks
What exactly do you want to pass to your CRM? The customer details or the order details?
Thanks
@Mukesh Tiwari Thanks for the your reply I want to pass the user and orders data both.
How to achieve this.
If you want to use event observer to capture the order submission data, you may use following event in event.xml
<?xml version="1.0" encoding="UTF-8"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd"> <event name="checkout_onepage_controller_success_action"> <observer name="brady_on_order_success_page" instance="Brady\SendOrdersToSap\Observer\OrderSuccess"/> </event> </config>
Then after in the observer you can get the Order data which you may process in some model class.
For the customer registration you may use customer_register_success event to get the required data.
Thanks
@Mukesh Tiwari
I used the Event and observers
<event name="checkout_onepage_controller_success_action"> <observer name=" my_observer_orderdispatch" instance="__\__\Observer\Orderdispatch" /> </event> <event name="checkout_submit_all_after"> <observer name="_My____observer_checkout_submit_all_after" instance="__\__\Observer\Customer\RegisterSuccessObserver" /> </event> <event name="checkout_allow_guest"> <observer name="my___observer_checkout_allow_guest" instance="__\__\Observer\Customer\CheckoutGuest" /> </event>
how to fetch the data into observer execution function.
public function execute(EventObserver $observer) { }
can you help me here to get the data here ?.
If you want to use event suggested by me then you may use code like following.
public function execute(Observer $observer): void { $orderIds = $observer->getEvent()->getOrderIds(); $order = $observer->getEvent()->getOrder(); $lastOrderId = $orderIds['0']; // Your code logic here }
Thanks