Reject Discount code for few products in Shopify Plus checkout

Ashish Kasama|April 2, 2018|1 Minute read|
Play
/ / Reject Discount code for few products in Shopify Plus checkout

SHARE

facebooktwitterwhatsapplinkedin
facebook
twitter
whatsapp
linkedin

It's been requested by multiple enterprise clients to remove discount code for particular products.

We thought to have 2 solution 

[data-reduction-form="update"] {
display: none
}

#Reject Discount for few products
reject = false
Input.cart.line_items.select do |line_item|
product = line_item.variant.product
if product.tags.include?('reject_code')
reject = true
end
end

if reject and Input.cart.discount_code
Input.cart.discount_code.reject(
message: "discount can't applied! for this product."
)
end
Output.cart = Input.cart

    Ashish Kasama

    One-stop solution for next-gen tech.

    Related Blogs

    The latest from our innovation team

    SEE ALL