(Estimated time to complete: 6 minutes)
Install Shopify’s Script Editor app (link)
Navigate to Apps → Script Editor
Create a new blank script
Title the script: Fondue block coupon codes for CashBack orders
Paste the following code into the Ruby source code
box
cashback_products_vendor = "Fondue"
cashback_products_product_type_prefix = "Fondue Cashback"
error_message = "Discount codes cannot be applied with CashBack"
has_cashback_product = Input.cart.line_items.any? { |item|
item.variant.product.vendor == cashback_products_vendor ||
item.variant.product.product_type.start_with?(cashback_products_product_type_prefix)
}
has_discount_code = Input.cart.discount_code != nil
if has_cashback_product and has_discount_code
Input.cart.discount_code.reject(
message: error_message
)
end
Output.cart = Input.cart
Press Save and publish