Reject Discount Code per item

Highlighted
Excursionist
19 1 1

How could the discount code do nothing without beeing rejected? If I dont reject it then wont it just apply?

0 Likes
Shopify Expert
9780 86 1531

A 0% discount code will still apply. Let's say that code is "foo". Shopify Scripts sees that the "foo" code is added then runs its logic to discount some items.

★ Winning Partner of the Build a Business competition. ★ http://freakdesign.com.au
0 Likes
Excursionist
19 1 1

Ah, ok, I understand what you mean, thank you for the sugestion. It doesnt apply to my problem tho because I am treating the discount code as a wildcard not something I could easily control. Controling the discount code behaviour trough the admin or api is the solution, however it isnt practical when you have many existing sales rules and 3rd party apps generate new ones regularly.

0 Likes
New Member
1 0 0

Did you ever find a working solution? I'm having the same issue. Shopify REALLY needs to add the ability to mark certain products as undiscountable in the admin. The accepted solution of creating an automatic collection isn't scalable if you have thousands of existing discount codes and dozens of distributed people creating future discount codes.

0 Likes
Excursionist
19 1 1

I did not find a solution unfortunately. I dont think there is a solution at this point. There are some really hacky things I thought might work with the script api but I did not try it -> Like for discountable products, on the first run you would set the discount in line item props, then reject the discount. On the cart refresh you should still have the props, use the info in them to apply a discount (make sure to have this capped since props are editable) and then finally remove the props.

0 Likes