Detect discount code type in shipping scripts

New Member
1 0 0

How can I tell if a user has entered a shipping or percentage discount? If I try to access Input.cart.discount_code.percentage and they used a shipping code, I get an error. I noticed in the docs Inputs.cart.discount_code returns "CartDiscount::Shipping, CartDiscount::Percentage, etc. "  but I can't seem to figure out the proper syntax:

if Input.cart.discount_code == CartDiscount::Shipping 
  #do something when user enters shipping discount code


Reply 1 (1)
Shopify Partner
18 0 20

Did you ever figure this out?  I'm struggling with the same thing.