Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add command for cart pruning #1303

Merged
merged 10 commits into from
Jan 15, 2024

Conversation

ryanmitchell
Copy link
Contributor

@ryanmitchell ryanmitchell commented Oct 11, 2023

This PR adds a command lunar:prune:carts and some new config params under lunar.cart.prune_tables to 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.

@vercel
Copy link

vercel bot commented Oct 11, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
lunar-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 19, 2023 7:44am

@glennjacobs
Copy link
Contributor

@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.

@ryanmitchell
Copy link
Contributor Author

Yep sorry I meant to ask where you'd want the docs to go - I wasnt sure where it best fitted.

@glennjacobs
Copy link
Contributor

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.

@wychoong
Copy link
Contributor

wychoong commented Oct 12, 2023

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.

The pipelines can be use to customize (eg: query cart older than X days) and sensible defaults being provided by lunar

also the query should be optimized with cursor fetch or paginated, and wrapped in DB::transaction

@ryanmitchell
Copy link
Contributor Author

Any thoughts on this one? Im happy to add to the docs if you point me in the right direction.

@glennjacobs glennjacobs added the enhancement Improvement to existing functionality label Dec 18, 2023
@glennjacobs glennjacobs added this to the v0.8 milestone Dec 18, 2023
@glennjacobs
Copy link
Contributor

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

@ryanmitchell
Copy link
Contributor Author

Thanks @glennjacobs. I've added some docs now.

@glennjacobs glennjacobs merged commit a243a91 into lunarphp:0.8 Jan 15, 2024
13 checks passed
@ryanmitchell ryanmitchell deleted the feature/add-cart-pruning branch January 18, 2024 12:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improvement to existing functionality
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants