Reputation: 136
Hi I have created a reactjs single page catalog using Rest API and we still have live magento 2.1 website running in vanilla mode.
Our live vanilla website support all required payment modes and therefore want my react web app to redirect checkout on live magento website.
I have successfully build the react app which can add products in cart and view cart using quoteID and Quote Mask ID. Now I need to know like vanila Magento can I set some session or cookies and then redirect user to live Magento website checkout page.
Now I have failed to understand how magento vanila frontend identifies guest user pulls exact cart items on their default cart page. what exactly are they storing in cookie or localstorage of the browser that they are able to map to the quote id in the backend.
If someone can direct me will be great. I have already looked into Quote table, Quote_items table and vistor table too but did not find any link to PHPSESSIONID. Now I doubt whether they even rely on it.
www.example.com is my live website and webapp.example.com is my PWA/ReactJS based which consumes Magento's Web api.
Upvotes: 1
Views: 804
Reputation: 49
public function __construct
(
\Magento\Framework\Session\SessionManager $sessionManager
)
{
$this->_session = $sessionManager;
}
public function execute(\Magento\Framework\Event\Observer $observer)
{
$sessionID = $this->_session->getSessionId();
}
URL: https://www.example.com?SID=sessionid
Example: https://www.example.com?SID=v32hjtpgt8e12jorc0tksekkj6
Magento store sessionid at cookie and session data at server which location is define in env.php
Upvotes: 0