Orders can not be edited in Commerce. Makes sense.

What we want to do however is make it very easy for someone to re-order a previous order. So for example they've had an order that contains "two pairs of socks, two pairs of pants, toothpaste, and soap" but they need all of that again as a new order.

Rather than manually having to do so, we want to offer a "re-order" button.

Given that an order is just a cart that's been marked complete, we're thinking it should just clone the order into a new cart, so they can review it and make any amends they need to, then just continue as normal with the checkout process.

I can not figure out how to do this though. Getting the Order is simple enough, and there's an existing cart set up too. But how would I punt that old Order into the new cart?

3 Answers 3


Using the MultiAdd plugin, you can do the following on the order page:

<form method="POST">
    <input type="hidden" name="action" value="multiAdd/multiAdd">
    <input type="hidden" name="redirect" value="commerce/cart">
    {{ getCsrfInput() }}
    {% for item in order.lineItems %}
        {% set itemNumber = loop.index %}
        <input type="hidden" name="items[{{ itemNumber }}][qty]" value="{{ item.qty }}">
        <input type="hidden" name="items[{{ itemNumber }}][note]" value="{{ item.note }}">
        <input type="hidden" name="items[{{ itemNumber }}][purchasableId]" value="{{ item.purchasableId }}">
        {% for key, option in item.options %}
            <input type="hidden" name="items[{{ itemNumber }}][options][{{ key }}]" value="{{ option }}">
        {% endfor %}
    {% endfor %}
    <input type="submit" value="Order Again" />

This adds a "Order Again" button with the same products and quantities, but options may be bit more difficult to sort out.

  • Getting the options duplicated are essential for this, unfortunately. I'll go from this and see where I get. Thanks! Update to follow... Nov 2, 2016 at 11:04
  • @MattWilcox I've updated my answer to include options and notes from the original order, that should now do what you need. Nov 2, 2016 at 11:32
  • Thanks! There was a slight bug in your code because you were nesting loops. I've corrected the code above. Nov 2, 2016 at 12:14
  • @MattWilcox Ah, thanks, only tested with 1 option per lineItem so didn't catch that! Nov 2, 2016 at 12:26

Re-ordering could be possible by building a cart update form on the front-end that is populated by a previous order.

You would need to use the Multi-Add plugin to submit more than one purchasableId at once, but everything else should work as expected.

  • Oh. To be clear, what you're saying it essentially - use the existing cart template as the basis, but populate it from the Order. It's a Twig thing, not a plugin thing? Nov 2, 2016 at 11:03

I've made a plugin to do this now and it has stock checks to display messages if the quantity has been adjusted due to the current availability of a variant. All previous options will be carried forward into the new cart also.

The benefit of using this plugin is that you don't need to loop through each line item of the order in the template to populate a form. This should speed things up on large orders for you as all you have to do now is submit the order id to the plugin controller and it will handle the rest.

I've used this on production sites with large numbers of variants and up to 12 custom options in a nested array where it's run without any issue for about 7 months. I thought I'd drop the link on here for anyone still attempting to create this functionality. I hope it helps.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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