Most-Used Shopify script conditions

Shopify Scripts are small pieces of code that let you create personalized experiences for your customers in their cart and at checkout. learn more

run only code applied

1
2
3
if  Input.cart.discount_code != nil and Input.cart.discount_code.code == "Your code"
#code here
end

customer is not empty and email contains target domain

1
2
3
4
5
TARGET_DOMAIN = 'companydomain.com'
customer = Input.cart.customer
if customer and customer.email and customer.email.include?(TARGET_DOMAIN)
#code here
end