Answer the question
In order to leave comments, you need to log in
How to store data about orders whose products can be deleted?
I want to understand how to store order data in a cafe if the products can be deleted.
For example, an order is stored in the database as a similar structure (we use MongoDB).
{
"id": 1,
"name": "Client",
"phone": "79000000000",
"address": "Address",
"comment": "Client comment",
"products": [
{
"id": 1,
"quantity": 1,
"variation_id": 2
},
{
"id": 3,
"quantity": 2
}
]
}
Answer the question
In order to leave comments, you need to log in
1. Store at least the SALES price in the order. Or where else to store it?
2. Products are not deleted, a status has been invented for this. (in general, you need to delete rows in the database as little as possible, you definitely do not have a project of the MVIDEO level, overhead costs will be fractions of%%.)
3. In 80% of box stores, a complete inventory is stored in the order - the product itself, price, parameters, quantity in.
Take a close look at your project - it's unlikely that you have 300 million products and 10,000 orders every day ...
Keep everything in order.
replace position deletion by changing status to Inactive and do not delete anywhere
Why not put full information about the product (including prices, ...) at the time of placing the order instead of id?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question