Per http://www.drupalcommerce.org/node/129,

Shopping Carts in Drupal Commerce will be saved and represented as orders. When a customer adds an item to his shopping cart, the action will create a new shopping cart order for the customer with the product in it. On subsequent pageloads, this order object will be available for us. However, as long as the order is still in the shopping cart state, its line items will be re-validated on load against the latest product prices / availability, etc. To that end, line items will need to specify at what point they're saved. For example, a discount line item doesn't need to be saved before an order is checked out, because discounts will be recalculated every time the order is loaded. Persisting such data across pageloads isn't really useful.

If an item is removed, delete the item from the order. If all items are deleted from the order, delete the order and provide a hook for modules to preserve any bit of data entered for reuse.

Orders can be identified as being in the shopping cart by both the order state and the fact that it will not have a merchant-defined order ID. As long as an order has not been checked out, it will not be revisioned.

Comments

rszrama’s picture

Issue tags: -Orders

Clarifying this issue, because things have changed. First off, revisions will happen regardless of whether or not an order is a shopping cart order. Also, more than just the shopping cart order state can determine if something is a cart or not... it actually happens at the status level now. Furthermore, deleting all the items from a cart order does not delete the order... I'm not even sure what kind of hook I imagined.

So, at this point all I can think needs to happen is the bit about line items being re-validated on cart load.

rszrama’s picture

Status: Active » Fixed

Finally got around to this thanks to the help of my new best friend, entity_metadata_wrapper(). ; )

https://github.com/rszrama/drupalcommerce/commit/df084d83879d29b02707902...

pieterdc’s picture

Looking forward to it.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.