<p>Using the <a href="https://github.com/engram-design/MultiAdd" rel="nofollow noreferrer">MultiAdd</a> plugin, you can do the following on the order page:</p>

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

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

CC BY-SA 3.0
2016-11-02T11:04:41.737Z
Getting the options duplicated are essential for this, unfortunately. I'll go from this and see where I get. Thanks! Update to follow...
Matt Wilcox
CC BY-SA 3.0
2016-11-02T11:32:18.107Z
@MattWilcox I've updated my answer to include options and notes from the original order, that should now do what you need.
Stephen Hamilton
CC BY-SA 3.0
2016-11-02T12:14:02.020Z
Thanks! There was a slight bug in your code because you were nesting loops. I've corrected the code above.
Matt Wilcox
CC BY-SA 3.0
2016-11-02T12:26:49.897Z
@MattWilcox Ah, thanks, only tested with 1 option per lineItem so didn't catch that!
Stephen Hamilton
CC BY-SA 3.0
2016-11-02T10:41:36.827Z
2016-11-02T12:13:58.227Z
2016-11-02T12:13:58.227Z
Stephen Hamilton
<p>Re-ordering could be possible by building a cart update form on the front-end that is populated by a previous order.</p>

<p>You would need to use the <a href="https://github.com/engram-design/MultiAdd" rel="nofollow noreferrer">Multi-Add plugin</a> to submit more than one purchasableId at once, but everything else should work as expected.</p>

CC BY-SA 3.0
2016-11-02T11:03:57.940Z
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?
Matt Wilcox
CC BY-SA 3.0
2016-11-02T10:45:47.157Z
2016-11-02T10:45:47.157Z
Luke Holder
<p>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.</p>

<p>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.</p>

<p>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.</p>

<p><a href="https://github.com/a-digital/repeatorder" rel="nofollow noreferrer">https://github.com/a-digital/repeatorder</a></p>

CC BY-SA 3.0
2017-11-20T13:32:17.153Z
2017-11-20T13:32:17.153Z
Matt Shearing
<p>Orders can not be edited in Commerce. Makes sense. </p>

<p>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.</p>

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

<p>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.</p>

<p>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?</p>

<plugin-development><plugin-craftcommerce>
Duplicate an existing Order as a new Cart in Commerce
# Duplicate an existing Order as a new Cart in Commerce

(Asked by: username_0 on 2016-11-02)

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?

**Tags:** plugin-development, plugin-craftcommerce

---

## 3 answers

### Answer by username_1 on 2016-11-02. Score: 3 | Accepted answer

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

    
    
    {{ getCsrfInput() }}
    {% for item in order.lineItems %}
        {% set itemNumber = loop.index %}
        
        
        
        {% for key, option in item.options %}
            
        {% endfor %}
    {% endfor %}
    


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

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

---

### Answer by username_2 on 2016-11-02. Score: 2

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](https://github.com/engram-design/MultiAdd) to submit more than one purchasableId at once, but everything else should work as expected.

> **Comments:**
> **username_0**: 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?  

---

### Answer by username_3 on 2017-11-20. Score: 1

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.

<https://github.com/a-digital/repeatorder>


---

