<p>This would probably require a plugin with a controller which you could post the order id to when clicking the button. Within the controller you could then query the database to get each line item and add it to the cart within a service if it is in stock and still enabled. The final step would then be to redirect to the basket or posted url.</p>

<p>The docs here should help you get started: <a href="https://craftcms.com/docs/plugins/controllers" rel="nofollow noreferrer">https://craftcms.com/docs/plugins/controllers</a></p>

CC BY-SA 3.0
2017-04-14T08:07:58.340Z
Well i know that, even i tried had created a plugin for the same, but i wasn't able to create a controller where i could put the same items of the order back into cart, maybe because i'm not so expert developer. If you could help in creating one, then i would be thankful to you.
hashtagerrors
CC BY-SA 3.0
2017-11-17T13:48:55.470Z
Apologies for the very late response on this but I've made a plugin to do this now as part of one of our own projects needs. I completely forgot about this stack exchange post if I'm honest but I'll post a link to the plugin as a separate answer in case you are still needing this.
Matt Shearing
CC BY-SA 3.0
2017-04-13T09:41:15.477Z
2017-04-13T09:41:15.477Z
Matt Shearing
<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 availability of a variant.</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-17T13:50:52.927Z
2017-11-17T13:50:52.927Z
Matt Shearing
<p>Another approach here is to use MultiAdd (<a href="https://github.com/verbb/multi-add" rel="nofollow noreferrer">https://github.com/verbb/multi-add</a>) to build a repeat order form rather than just a button to repeat the whole order.</p>

<p>Depends entirely on what you want, but this can be a bit more flexible as it allows them to repeat the same items but potentially change quantities or notes etc., and means you can display stock issue messages and so on <em>before</em> they get to the cart screen, which is perhaps handier for the customer.</p>

<p>It's easy to do - just loop through the old order as your're building your MultiAdd form and give each item a unique index, check for stock and display appropriate warnings at that point, etc.</p>

<p>(You can also use MultiAdd to create the one button approach of course, just using hidden fields instead of inputs, and that might be handy if you happen to be using MultiAdd anyway and want to keep your plugin numbers down, and/or want those stock messages on show before they go through the add to cart process).</p>

CC BY-SA 3.0
2017-11-18T22:36:46.137Z
2017-11-18T22:36:46.137Z
Jeremy Daalder
<p>I want to have a button on order information page when clicked the same order should be repeated. How can I put the same products again in the cart or simply re-order again?</p>

<plugin-craftcommerce><ecommerce>
How can I re-order the same order?
# How can I re-order the same order?

(Asked by: username_0 on 2017-04-13)

I want to have a button on order information page when clicked the same order should be repeated. How can I put the same products again in the cart or simply re-order again?

**Tags:** plugin-craftcommerce, ecommerce

---

## 3 answers

### Answer by username_1 on 2017-04-13. Score: 1

This would probably require a plugin with a controller which you could post the order id to when clicking the button. Within the controller you could then query the database to get each line item and add it to the cart within a service if it is in stock and still enabled. The final step would then be to redirect to the basket or posted url.

The docs here should help you get started: <https://craftcms.com/docs/plugins/controllers>

> **Comments:**
> **username_0**: Well i know that, even i tried had created a plugin for the same, but i wasn't able to create a controller where i could put the same items of the order back into cart, maybe because i'm not so expert developer. If you could help in creating one, then i would be thankful to you.  
> **username_1**: Apologies for the very late response on this but I've made a plugin to do this now as part of one of our own projects needs. I completely forgot about this stack exchange post if I'm honest but I'll post a link to the plugin as a separate answer in case you are still needing this.  

---

### Answer by username_1 on 2017-11-17. 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 availability of a variant.

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


---

### Answer by username_2 on 2017-11-18. Score: 1

Another approach here is to use MultiAdd (<https://github.com/verbb/multi-add>) to build a repeat order form rather than just a button to repeat the whole order.

Depends entirely on what you want, but this can be a bit more flexible as it allows them to repeat the same items but potentially change quantities or notes etc., and means you can display stock issue messages and so on *before* they get to the cart screen, which is perhaps handier for the customer.

It's easy to do - just loop through the old order as your're building your MultiAdd form and give each item a unique index, check for stock and display appropriate warnings at that point, etc.

(You can also use MultiAdd to create the one button approach of course, just using hidden fields instead of inputs, and that might be handy if you happen to be using MultiAdd anyway and want to keep your plugin numbers down, and/or want those stock messages on show before they go through the add to cart process).


---

