Why is my free gift not displaying in the cart?

Hi,

The coding is not working on the website. I have already entered free gift over price and variant id , but it cannot shown in cart. I am using the same method to show free gift on another shopify website,it works.

I am wondering how can we show this product at front end on this website.

https://embryolissehk.myshopify.com/admin/products/6934487793854/variants/40533902327998

Hoping for some experts’ advise. Thank you so much.

Hi there, you are missing a closing } bracket on the first else if condition.

You should change

else if ( ( cartItems.length >= 1 ) && ( qtyInTheCart !== 1 ) && (cartTotal >= 25000 ) ) {
      cartUpdates = { 40533902327998: 1 }
    else if ( ( cartItems.length >= 1 ) && ( qtyInTheCart > 0 ) && (cartTotal < 25000 ) ) {
      cartUpdates = { 40533902327998: 0 }
    }

To:

else if ( ( cartItems.length >= 1 ) && ( qtyInTheCart !== 1 ) && (cartTotal >= 25000 ) ) {
      cartUpdates = { 40533902327998: 1 }
    }
    else if ( ( cartItems.length >= 1 ) && ( qtyInTheCart > 0 ) && (cartTotal < 25000 ) ) {
      cartUpdates = { 40533902327998: 0 }
    }

Hi,

I have addeda closing } bracket ,but still no free gift shown in shopping cart :disappointed_face: Is there anything else we can do, thanks for your help.