Block discount code on top of shopify script

New Member
5 0 0

Afternoon, i've seen similar questions but i'm really struggling on the implementation.

 

I have experience with HTML, CSS & Javascript but not Ruby so it's rather confusing.

The script for the discount is contained in this link: https://www.pastiebin.com/5cdaa1632079b

 

I have looked and you can indeed reject discount codes using scripts, this is the code i found

 

Input.cart.discount_code.reject({message: "Save 10% with our Sets"})

 

However i cannot place this code inside my existing script without it erroring, can anyone point me in the right direction?

 

 

 

 

 

 

0 Likes
Highlighted
New Member
5 0 0

I worked this out myself, here is the correct code that needs to be added. 

 

if Input.cart.discount_code
  Input.cart.discount_code.reject(
    message: "Discount codes cannot be redeemed with our Sets"
  )
end

The placement of the code is below, add the snippet just above the CAMPAIGNS = [ section and it works.

 

screenie.png

0 Likes