-
Notifications
You must be signed in to change notification settings - Fork 292
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
Comments
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. |
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 |
What if the user already had the item in their cart? |
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. |
Sounds reasonable. |
This PR provides an option to automatically add BuyXGetY discount rewards. It adds a toggle to the discount create/edit screen to automatically add. When selected we work out if any rewards are available that haven't yet been added to the cart and if we so we add them. Along the way we keep track of how many we added, so we can decrement/increment if cart values are changed, and if necessary remove the item from the cart when it no longer is eligible. Devs can check for whether an item was added by discount by checking the meta->added_by_discount array values ... if the sum is the same as the cart line quantity then it was added by a discount and can be displayed differently (if required). Replaces #1385 Closes #876 --------- Co-authored-by: Alec Ritson <hello@itsalec.co.uk> Co-authored-by: Glenn Jacobs <glenn@neondigital.co.uk>
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
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?
The text was updated successfully, but these errors were encountered: