Articles on: Discounts

How to limit an upsell discount to just 1 item

If you want to create a strong incentive to have a customer buy another item, you can offer a nice discount on an upsell product.

If you're offering this as an exclusive discount, you might want to limit the quantity of items that can be bought at the discounted price to 1.

This is the Shopify Script you can use to achieve that:

Input.cart.line_items.each do |line_item|
		if line_item.quantity > 1
			discounted_items = line_item.split(take: 1)
			Input.cart.line_items << discounted_items
			line_item.change_line_price(line_item.line_price * 0.90, message: "Upsell Discount")
Output.cart = Input.cart

In this example, the discount is 10% and limited to just 1 item.

Updated on: 12/01/2023

Was this article helpful?

Share your feedback


Thank you!