简体   繁体   中英

Shopify Script - Message when user try to stacking discount codes

Is that possible, via Shopify Script Editor to show a user message when it tries to stack discount codes on the checkout?

I want to allow the user to add any new valid promotion code with regular behavior (attach)

But I want to show a message saying that would not be possible to use 2 discount codes at the same time

My current script is like this:

Output.cart = Input.cart
exit unless Input.cart.discount_code
if Input.cart.discount_code > 1 
  Input.cart.discount_code.reject({ message: 'Only 1 code can be applied at a time' })
end 
Output.cart = Input.cart

Regular Behavior

在此处输入图像描述

Thank you in advance

The script editor does not allow to stack multiple coupon discounts, so you do not need to add this validation.

Shopify doesn't allow user to use more than one discount code during checkout, you dont need to worry on this

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM