Personalized checkout and custom promotions with Shopify Scripts
I have this piece of code that works great, but I need it to skip this discount if a coupon code worth $50 or more is used at checkout. I also need it to not break the rest of the cart scripting which it does with nearly every attempt I've made.
Here is the current script portion:
DISCOUNT_AMOUNT = 5
if (!Input.cart.customer.nil? && Input.cart.customer.accepts_marketing?)
Input.cart.line_items.each do |line_item|
line_item.change_line_price(line_item.line_price * (1.0 - (DISCOUNT_AMOUNT / 100.0)), message: "#{DISCOUNT_AMOUNT}% off for subscribing to our newsletter!")
end
end
Can anyone point me in the right direction?
By investing 30 minutes of your time, you can unlock the potential for increased sales,...
By Jacqui Sep 11, 2024We appreciate the diverse ways you participate in and engage with the Shopify Communi...
By JasonH Sep 9, 2024Thanks to everyone who participated in our AMA with 2H Media: Marketing Your Shopify St...
By Jacqui Sep 6, 2024