I would like to be able to have an existing order that has already been checked out back into a user's shopping cart. From what I have read from the documentation, a shopping cart is just an order for a user.

This is relevant because when my user's checkout the order, it only does an authorize only transaction, which means the funds have not been transferred yet. I want to allow my user's a window of time to change their order.

So, I figured the best way to do this was to take the order that they want to edit, void it out, and then put it back into their shopping cart.

I can't seem to find an api call for this. I saw hook_commerce_cart_order_is_cart_alter in the commerce_cart API, but I couldn't figure out when this was called or if this was a use case for this API call.

1 Answer 1


As you mentioned a shopping cart is nothing more than an order with the state of cart.

So all you need to do is to update the state of $order to cart using commerce_order_status_update() function:

$log = t('Reverting back to Cart state so the customer can modify items.');
commerce_order_status_update($order, 'cart', $skip_save = FALSE, $revision = TRUE, $log);

Alternatively if you are using rules, you can use the rule: "Set order status : Cart" which comes with commerce module out of the box.

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.