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.
According to the last reply in this topic https://community.shopify.com/c/Script-Editor/Script-recognizes-customer-when-not-logged-in/td-p/434... there is no way to differentiate between registered and non registered customers.
You can check the customer tags in a script so maybe you could tag your registered customers in advance and then in the script instead of checking the email, check if the customer tags contain the registered one, if it does not then apply the discount.