Have your say in Community Polls: What was/is your greatest motivation to start your own business?

How to make a coupon cancel a script discount?

How to make a coupon cancel a script discount?

IvGordiichuk
Shopify Partner
37 1 9
Hi.

I have bulk deals script, which makes discounts on some products depending on the quantity. When the script is triggered, the coupon entry field on the checkout is hidden so as not to apply additional discounts.
If I apply automatic discount on the site, then I have to turn off the script, since both discounts are applied...

Can I make it so that if there is an automatic discount for an item in the cart, the script does not work? This is the first task.

And the second - I don’t know how possible - entering a coupon on the checkout cancels the action of the script.
The user on the checkout can choose whether to use a script discount or enter his own coupon. If you entered a coupon, the script does not work and the coupon discount is applied. If you deleted the coupon - a discount from the script. Thank you!
Reply 1 (1)

PaulNewton
Shopify Partner
7450 657 1565

Hi @IvGordiichuk 

Should just be able to check Input.cart.discount_code and if true then a discount exists, not 100% sure if that works with automatic discounts.

 

Inspect some of the sample checkout-scripts 

https://help.shopify.com/en/manual/checkout-settings/script-editor/examples/line-item-scripts 

https://github.com/Shopify/shopify-scripts/tree/master/Line-Item/Stop%20customers%20from%20using%20a... 

 

 

Similar post seems like it's not obvious to detect automatic discounts and it's rules? not possible?

https://community.shopify.com/c/shopify-scripts/detect-automatic-discounts/m-p/674105 

 

https://community.shopify.com/c/forums/searchpage/tab/message?advanced=false&allow_punctuation=true&... 

 


@IvGordiichuk wrote:
The user on the checkout can choose whether to use a script discount or enter his own coupon. If you entered a coupon, the script does not work and the coupon discount is applied. If you deleted the coupon - a discount from the script.

Not sure that can be done with just checkout-scripts and would need customizations to checkout.liquid itself for a back and forth system.

 

Contact paull.newton+shopifyforum@gmail.com for the solutions you need


Save time & money ,Ask Questions The Smart Way


Problem Solved? ✔Accept and Like solutions to help future merchants

Answers powered by coffee Thank Paul with a Coffee for more answers or donate to eff.org