Apply discount for unregistered customers

Highlighted
Globetrotter
536 43 110

Hey everyone, I was just wondering if you could apply discounts to customers who aren't registered with the site? We would like to apply free shipping for customers who shop with us through Ipsy. I figure we could do this through:

 

if Input.cart.customer
Input.shipping_rates.each do |shipping_rate|
  next unless shipping_rate.source == "shopify"
  if Input.cart.customer.email.include? 'ipsy.com'
  shipping_rate.apply_discount(shipping_rate.price * 1.0, message: "Free shipping for Ipsy")
  end
end
end
Output.shipping_rates = Input.shipping_rates

Now this works if I enter a customer that has ipsy.com in their email, but I can't tell if this would work for anyone who just buys through the site and doesnt register. Does anyone know if this can be done? Thanks for your time. 

0 Likes