Skip to content

Commit

Permalink
fix: hide free sticker notice when stickers are added to the shopping…
Browse files Browse the repository at this point in the history
… cart (#264)

closes #246
  • Loading branch information
KirankumarAmbati authored and jlengstorf committed Apr 19, 2019
1 parent f822ac0 commit 373329d
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/components/Cart/Cart.js
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,8 @@ class Cart extends Component {
render() {
const { status, toggle } = this.props;
const { className } = this.state;
let showFreeBonus = true;
const gatsbyStickerPackID = "Z2lkOi8vc2hvcGlmeS9DaGVja291dExpbmVJdGVtL2I1ZGY0NjRmMWQxYWQxM2MzMzJjYmQ0MjMyZDczZGE3P2NoZWNrb3V0PTY1NjU3NDMxMjk2MTRiMmRjZjc4MDIzYmRlYzA4MTM2";

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

checkout.lineItems.forEach(({id}) => {
if(id === gatsbyStickerPackID) {
showFreeBonus = false;
}
});

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

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

<ShippingInfo />
</Content>
) : (
Expand Down

0 comments on commit 373329d

Please sign in to comment.