The question:
I am not sure how quotes work in Magento. I saw that a quote id is assigned to customer when is created. Sometimes I see in sales_flat_quote table that for one customer there are 2 lines there…I mean there are 2 quotes.(actually one has store_id=0 and one store_id=1) When a users log in through API (custom code) it seems that a new quote is assigned to. I don’t get what is happening..or how should this work..
The Solutions:
Below are the methods you can try. The first solution is probably the best. Try others if the first one doesn’t work. Senior developers aren’t just copying/pasting – they read the methods carefully & apply them wisely to each case.
Method 1
A quote is actually a ‘cart’ object.
A customer can have many quotes. One for each website.
the quote object is not created when the customer is created. It is created when the customer adds the first product to the cart.
Also a quote is not necessarily assigned to a customer. You can have a quote when browsing the website as guest.
In that case the quote remains in the db after the session expires.
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0