Add command for cart pruning#1303
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
|
@ryanmitchell thanks for this. I think we need some documentation somewhere for this and also a test, as we don't want to make any mistakes with deleting carts. |
|
Yep sorry I meant to ask where you'd want the docs to go - I wasnt sure where it best fitted. |
It's a good point. I had started updated docs for this config area, I could do with merging what I've done so far. I'll review and get back to you. |
|
Do you think create 2 commands and a documentation to add the command into app console kernal gives more flexibility to control how frequent it should be called.
also the query should be optimized with cursor fetch or paginated, and wrapped in DB::transaction |
|
Any thoughts on this one? Im happy to add to the docs if you point me in the right direction. |
I would probably suggest adding something to https://docs.lunarphp.io/core/reference/carts.html |
|
Thanks @glennjacobs. I've added some docs now. |
This PR adds a command
lunar:prune:cartsand some new config params underlunar.cart.prune_tablesto determine how pruning should be carried out.I opted for using a pipeline for amending the query, as we ultimately always seem to end up there.
I've tried to default to some sensible settings (90 days, dont prune carts with orders associated).
If pruning is enabled we automatically add a daily task rather then needing the developer to do it.