Developer forum

Forum » Development » reordering an order via dwapi

reordering an order via dwapi

Mikkel Hammer
Mikkel Hammer
Reply

Hi,

It seems like there's no way to "reorder" an order via the dwapi.
Right now if you were to "reorder", you would have to loop every orderline from the old order and add them one by one to your current cart.

Is it possible to add a way to add multiple items at once, since the current "/dwapi/ecommerce/carts/{secret}/items" endpoint currently only takes one product at a time.
Or/and a new POST "/dwapi/ecommerce/order/{secret}/reorder" endpoint with a body that takes a secret, which just adds all the products from the "/{secret}/reorder" order to the cart secret that's in the body request.

Best regards,
Mikkel Hammer


Replies

 
Nicolai Pedersen Dynamicweb Employee
Nicolai Pedersen
Reply

I think that if you get the old order, creates a new cart, and post that old order using the cart secret, you have what you need?

 
Mikkel Hammer
Mikkel Hammer
Reply

Hi Nicolai,

It does work, but it's not really what we're looking for. 
We're looking for a way to easily put an old order's products in the current cart. 
So the user can keep their products in the current cart, change delivery, etc.

Best regards,
Mikkel Hammer

 
Nicolai Pedersen Dynamicweb Employee
Nicolai Pedersen
Reply

Kind of the same.

Get the old order, add the orderlines to your current order, and patch it... Should be really simple? Or what am I missing?

BR Nicolai

 
Mikkel Hammer
Mikkel Hammer
Reply

Hi Nicolai,

Doesn't that just return to the first question i asked, if there is a way to add multiple products at a time that im not aware of?
What if i have a order with 30 orderlines, i would have to loop the 30 orderlines and add them one by one to the current cart?

It's fairly easy to do, but it would be cleaner with a single call instead of 30 :)

Best regards,
Mikkel Hammer

 

You must be logged in to post in the forum