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: hide free sticker notice when stickers are added to the shopping cart #264

Merged
merged 2 commits into from
Apr 19, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
chore: closes #246 - Free Gift bug
KirankumarAmbati committed Apr 13, 2019
commit 7fe04f79aabdca5fc9e399a4d33320c5f78614d5
10 changes: 9 additions & 1 deletion src/components/Cart/Cart.js
Original file line number Diff line number Diff line change
@@ -316,6 +316,7 @@ class Cart extends Component {
render() {
const { status, toggle } = this.props;
const { className } = this.state;
let showFreeBonus = true;

return (
<StoreContext.Consumer>
@@ -340,6 +341,12 @@ class Cart extends Component {
(total, item) => total + item.quantity,
0
);

checkout.lineItems.forEach(({title}) => {
if(title === 'Gatsby Sticker Pack') {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we may want to check for something other than the title — there's no guarantee we won't tweak the name of the product. Something like the slug or ID would probably be better here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jlengstorf Gatsby Sticker Pack ID is having 140 characters length. Is it okay to use it ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That should be fine. Thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jlengstorf Made changes to replace title with ID. Please can you verify. Thanks!

showFreeBonus = false;
}
});

return (
<CartRoot
@@ -407,7 +414,8 @@ class Cart extends Component {
Back to shopping
</BackLink>

<FreeBonus />
{ showFreeBonus && <FreeBonus /> }

<ShippingInfo />
</Content>
) : (