From the course: Next.js Ecommerce: Build a Shopping Platform from Scratch

Unlock this course with a free trial

Join today to access over 25,200 courses taught by industry experts.

Update order actions (COD)

Update order actions (COD)

All right, so we're able to view our orders. We can delete them. What I want to be able to do now is go to an order page like this, and as an admin, I want to be able to mark it paid and mark it delivered. And this would be usually for cash on delivery. So in this video, we'll create the actions for both, for marking it paid and for marking it delivered. And in the next video, we'll add the buttons. So let's open up our order actions and go down to the bottom. And we're going to create our function to update the order to paid by COD. So let's say update COD order to paid. And we're going to export function. And we're going to call this updateOrderToPaid. We already have that function, so I'm going to add on COD at the end like that. And it's going to take in the order ID, which is going to be a string. Now, this is actually easy because we can already use the updateOrderIdToPaid function that we have. So let's do a try catch. And let's just throw in the catch real quick. Click return,…

Contents