Save the Order
Understand how to save customer orders after checkout by storing order details such as session ID, price, and quantity. Explore creating models, repositories, and APIs to manage orders and order items. Learn to fetch order history for users and ensure cart items are deleted after placing an order, solidifying backend order management.
We'll cover the following...
Introduction
In this lesson, we’ll learn how to save the order after checkout. Remember, we have a list of cartItems. Stripe response gave us a sessionId, which need to be stored.
We also need to store productId, price and quantity. You might wonder what is the need to store price, if we’ve stored productId. It can be fetched from the product table if needed. Storing price is helpful when it is updated in the product table, and we need to show ...