Personalized checkout and custom promotions with Shopify Scripts
I have this line at the top of my code:
if Input.cart.discount_code&.code == "CYBER2023" && !Input.cart.discount_code&.rejected?
However, if the code is rejected (like it has a minimum of $100 and the cart is $50), it rejects the code but applies everything that comes after the if statement above.
So, I have 2 questions:
- How can I make scripts not work if the code is not applied? (In production it simply passes that the code is not rejected even if it is)
- If that's not possible, how do I implement features like the discount only being used once per customer?
Learn how to build powerful custom workflows in Shopify Flow with expert guidance from ...
By Jacqui May 7, 2025Did You Know? May is named after Maia, the Roman goddess of growth and flourishing! ...
By JasonH May 2, 2025Discover opportunities to improve SEO with new guidance available from Shopify’s growth...
By Jacqui May 1, 2025