Personalized checkout and custom promotions with Shopify Scripts
Hi There, thanks in advance for help. I have a working shopify discount script but need to add a product tag(s) to it and cannot seem to find a solution that works. Here is the script:
DISCOUNT_AMOUNT = 40
if (Input.cart.line_items.size > 1)
line_item = Input.cart.line_items.sort_by { |line_item| line_item.variant.price }.last
if line_item.quantity > 1
line_item = line_item.split(take: 1)
Input.cart.line_items << line_item
end
line_item.change_line_price(line_item.line_price * (1.0 - (DISCOUNT_AMOUNT / 100.0)), message: "#{DISCOUNT_AMOUNT}% off!")
end
Output.cart = Input.cart
I need this to reflect products with specific tag. If qualified item(s) is in the cart and it is the highest priced item, discount will be applied to that item.
Advise?
Portrait of Stephen positioned next to an image of planet Earth, with the Stephen's World ...
By JasonH Mar 18, 2024Digital marketers and app developers have tracked activity in apps and websites for yea...
By Ollie Mar 13, 2024February was an exciting month with Shopify Editions, informative webinars, and more! F...
By JasonH Mar 7, 2024