Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

Discount BuyXGetY automatically add #876

Closed
ryanmitchell opened this issue Feb 22, 2023 · 5 comments · May be fixed by #1733
Closed

Discount BuyXGetY automatically add #876

ryanmitchell opened this issue Feb 22, 2023 · 5 comments · May be fixed by #1733
Labels
enhancement Improvement to existing functionality

Comments

@ryanmitchell
Copy link
Contributor

It would be great if there was the option to add Y items automatically to the cart when you have matching X items in your cart. This is really useful for say a free ebook alongside a paperback purchase.

I'd be happy to work on this if it was something you'd consider acceptable?

@ryanmitchell ryanmitchell added the enhancement Improvement to existing functionality label Feb 22, 2023
@glennjacobs
Copy link
Contributor

It's a tricky one as then does the item also get automatically removed when you no longer qualify for the discount?

Happy to consider a PR. But think it would need to go into 0.3 now, as we really need to finish up on 0.2.

@ryanmitchell
Copy link
Contributor Author

Yeah it would be automatically removed when no longer eligible. And yep it gets complicated :)

I’ll have a go at it over the next couple of weeks - happy for it to wait to 0.3

@glennjacobs
Copy link
Contributor

What if the user already had the item in their cart?

@ryanmitchell
Copy link
Contributor Author

So I would suggest we use the meta on the cart line to indicate it was 'added_by' another cart line id(s) ... then if that/those cart lines are removed then it would remove the free discount.

The other option would be to flag it as added by a discount, then on cart item add/edit/remove we validate any line items added by discount to ensure they are still valid and if not remove them.

@glennjacobs
Copy link
Contributor

Sounds reasonable.

@lunarphp lunarphp locked and limited conversation to collaborators May 23, 2023
@alecritson alecritson converted this issue into discussion #1041 May 23, 2023

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →