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

fix: when same 'offer product' with different 'offer price' needs to be shown, made sure the best offer among them is shown #68

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

hz-tyfoon
Copy link

when there's multiple bumps for same products with different 'offer price' and they all are eligible to be shown in the checkout page, made sure the one with be 'best offer' (cheapest price) show's for the bump.

Before this fix, in the described scenario the bump that was created last, was showing in the checkout page for that 'offer product' regardless of their 'offer price', which shouldn't be the case.

For more clarity, take 2 bumps for example, where both of the bumps is for a product smartphone. One of the bump is like: if you buy a laptop you'll get 30% discount on the smartphone. And the other one is, if you buy a macbook you'll get 50% discount on that same smartphone.
Now, if a customer adds both laptop & macbook to their cart which one of 'those 2 discounts for the smartphone' should be shown?
should he see the '30%' or should he see the '50%' discount?
Clearly he should get the 'best' among those 2 which is '50%'.

And that's basically what was done in this commit. Before this fix it used to show the 'offer price' from the bump that was created last.

Resolves #47

…be shown, made sure the best offer among them is shown

when there's multiple bumps for same products with different 'offer price' and they all are eligible to show in the checkout page, made sure the one with be 'best offer' (cheapest price) show's for that offer product.

Before this fix, in the described scenario the bump that was created last was showing in the checkout page for that 'offer product' regardless of their 'offer price', which shouldn't be the case.

For more clarity, take 2 bumps for example, where both of the bump is for a product 'smartphone'. One of the bump is like: 'if you buy a 'laptop' you'll get '30% discount' on the 'smartphone'. And the other one is, if you buy a 'macbook' you'll get '50% discount' on the 'smartphone'.
Now, if a customer adds both 'laptop' & 'macbook' to their cart which one of 'those 2 discounts for the smartphone' should be shown? should he see the '30%' or should he see the '50%' discount? Clearly he should get the 'best' among those 2 which is '50%'. And that's basically what was done in this commit.

Resolves #47
@code-with-mehedi code-with-mehedi added the future use To use a feature in the future label Jun 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
future use To use a feature in the future
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants