Embark on a journey of innovation & problem-solving at the DataThrone Hackathon and win a prize worth of 1 Lakh+. Register now! 

Reject Discount code for few products in Shopify Plus checkout

Ashish Kasama|4/2/2018, UTC|1 MIN READ|
Play
//Reject Discount code for few products in Shopify Plus checkout

Share

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

    Looking for

    Development

    Solutions?

    Lets Discuss
    Lucent innovation
    We are a family filled with talented experts that help global brands, enterprises, mid-size businesses or even startups with innovative solutions.
    Newsletter
    Accelerate your tech projects with us. Get in touch with us.
    Follow us
    facebooklinkedinyoutubeinstagramtwitter
    lucent innnovation: cltuch

    Lucent Innovation, © 2024. All rights reserved.Privacy policyDMCA compliant image