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

Provide an option to automatically add BuyXGetY discount rewards #1385

Conversation

ryanmitchell
Copy link
Contributor

3rd times a charm?

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 #881
Closes #876

Copy link

vercel bot commented Dec 19, 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 Feb 23, 2024 8:47am

@ryanmitchell ryanmitchell changed the base branch from 0.7 to 0.8 December 19, 2023 09:23
@glennjacobs glennjacobs added the enhancement Improvement to existing functionality label Dec 19, 2023
@glennjacobs glennjacobs added this to the v0.8 milestone Dec 19, 2023
@glennjacobs
Copy link
Contributor

Hi @ryanmitchell, apologies for taking so long to review this. However, we're not looking to add new functionality to the v0.8 release now. Could this be ported to v1.x?

@ryanmitchell
Copy link
Contributor Author

3rd time isn't a charm then 😄
I'll get a look in the next few days.

@glennjacobs
Copy link
Contributor

3rd time isn't a charm then 😄 I'll get a look in the next few days.

Sorry :-)

@glennjacobs glennjacobs closed this May 8, 2024
glennjacobs added a commit that referenced this pull request Jun 11, 2024
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 <[email protected]>
Co-authored-by: Glenn Jacobs <[email protected]>
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.

Discount BuyXGetY automatically add
3 participants