I am currently creating a cart for an anonymous user using magento API. These are the endpoints I am using to accomplish this:

http://www.magentocommerce.com/api/soap/checkout/cart/cart.create.html http://www.magentocommerce.com/api/soap/checkout/cartProduct/cart_product.add.html

From this i get a quote id.

My question is, is it possible to use the quote id to create a session in the browser? Ie what i want to do is on a 3rd party site create and items to an order. Using this quote_id provide a link to the magento cart that would have the cart contents. The user then could then login, proceed through checkout, etc.

1 Answer 1


You can't create a session via that API, but you could create a custom controller which associates the current session to a given quote ID. Here's some untested controller code to get you started:

// Associates the current session with the given quote
public function associateAction($quoteId)
    $quote = Mage::getModel('sales/quote')->load($quoteId);
    if (!$quote->getId()) {
        // Quote not found
        return $this->_redirect('checkout/cart/');

    if ($quote->getCustomerId()) {
        // This quote belongs to a customer
        return $this->_redirect('checkout/cart/');

    $cart = Mage::getSingleton('checkout/cart');


Please don't use this code in production until you've also considered the following:

  1. This can be abused by Bad Guys to access quotes they shouldn't see! Please consider using a nonce or hashing/encrypting the quote ID parameter so that others can't "guess" IDs.
  2. What if the user had items in their cart? This will remove those products (by changing the active quote)
  3. I'm sure I'm forgetting something else

Hope that helps!

  • $quote = Mage::getModel('sales/quote')->load($quoteId); if (!$quote->getId()) { // Quote not found return $this->_redirect('checkout/cart/'); } I have tried this code but the am always getting into the if statement. Though when using the api i can get a view my cart and the contents i recently added.
    – richv
    Commented Aug 8, 2014 at 18:21
  • how can I display my API values as a table format. my post : magento.stackexchange.com/q/209734/57334
    – zus
    Commented Jan 18, 2018 at 5:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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