Closed wautersj closed 3 years ago
You can't, so nobody can mess around with them. That was the basic idea behind this behavior.
Does that make sense?
Oh, oke. That's an issue for me right now;
I now have some test orders on my production environment. And when we have the go live, the clients woud like these orders to be removed.
I understand the reasoning behind the idea of not deleting orders. But in most other shop platforms I'm able to do this. If only as super admin that would also be oke.
We should implement it for super users only.
Enabling it for super users only is a good start!
Statamic has permissions management, it could also be managed there as option for a user role.
Is there another way, that I can clear the orders today? (It's oke if I need to perform a command / run a script somewhere/)
Can you download your sqlite file from production, delete the orders via a GUI and upload the file again?
Is that an option?
I used the logic in the answer to achieve the desired result: https://stackoverflow.com/questions/15484404/how-to-delete-all-the-rows-in-a-table-using-eloquent
Calling Order::truncate(); once, got the job done. (And then immediately remove the line from production again)
I am still not sure if this a great idea, but it's a valid point to have some kind of this functionality.
What would you think about a system settings page, where you can truncate all orders from the table? Would this be a good solution @wautersj ?
Why should deleting an order be a problem? A work around about that might be a soft delete? Truncate all orders sounds problematic... what happens if "somebody" clicks on it? Is there something like "please validate the deletion...." or something like that...
To make sure that nobody is messing around with this.
It's for example not possible to delete any order in Shopify. You can cancel the order, but it will always be visible and can't be removed completely. This does make sure nobody can manipulate them.
The system settings should not be visible for normal users. A confirmation modal would be required to make sure nobody does delete anything by accident.
A sort of status would be useful indeed.
I believe there currently is a mollie/payment (context) status attached to an order.
It would be useful to have a 'Seller status', tho I'm not completely sure yet how it should work. The shop owner(s) should be able to mark an order as 'canceled', or 'refunded' of some sort. Currently it is not possible to work with 'Credit Notes', to refund a customer, if the order needs to be 'cancelled' or a product was sent back, for example...
I believe this is an essential part to any webshop, because it is a scenario that realistically, happens on a monthly base.
'Deleting orders' might be a wrong title for the issue i'm having. It's just that I need to be able to 'change something' to an order or order status, after it was placed (and paid).
A simple solution would be to enable the truncate / delete order functionality ONLY WHEN SITE IS IN TESTING/DEVELOPMENT mode in the environment file - a production site would follow the needs like shopify of not wanting to delete any order - but a testing site should be able to by super admins to get rid of test orders or to go in and correct/delete an order from a local env copy
I deleted via a DB GUI but it would be nice to be able to delete test orders in the CP
I am thinking about implementing a config option 'allow_deleting_orders, where you could choose between the following options:
Adjusting it like this would give a lot of options and every developer can decide for himself, what fits him best.
Sounds like a great idea
I am thinking about implementing a config option 'allow_deleting_orders, where you could choose between the following options:
* 'never' (You can't delete anything. Status quo) * 'development' (set as default. As long as not in production, you can delete orders) * 'admin' (Only super admins can delete orders) * 'always' (Orders can be deleted in production as well. Maybe you would need permissions as well?)
Adjusting it like this would give a lot of options and every developer can decide for himself, what fits him best.
That would be perfect, and gives the most flexibility
How can I delete orders in the CP?