Personalized checkout and custom promotions with Shopify Scripts
We're moving the community! Starting July 7, the current community will be read-only for approx. 2 weeks. You can browse content, but posting will be temporarily unavailable. Learn more
Hi, I need the ability to disable all coupon codes, even the ones generated by affiliate and reward apps, for select products that are On-Sale. If you have the ability to apply to a collection, that would be great.
The problem that is happening is, discount codes generated by apps don't have a setting or a rule that prevents codes from being used on Sale Items.
Any help is greatly appreciated!
I just found this code that works (below). Can someone modify it so it can block by TAG or COLLECTION?
productId = 10199241991 Input.cart.line_items.each do |line_item| product = line_item.variant.product puts product.id next if product.gift_card? next unless product.id == productId case Input.cart.discount_code when CartDiscount::Percentage Input.cart.discount_code.reject({message: "Cannot be used with this product"}) end end Output.cart = Input.cart