Migrating a reject discount code script
This one changed under everyone’s feet. Rejecting a typed code was impossible for a discount function until December 2025 and is possible now, with one restriction that decides whether your file can be rebuilt.
Nog niet mogelijkIt rejected the discount code the shopper had entered and showed them a reason.
Plak het in Scripts-redding en kijk wat eruit komt
- Kopieer de Ruby met de knop naast elk Script op deze pagina.
- Open in je Shopify-beheer Stackable, dan Hulpmiddelen, dan Scripts-redding.
- Plak het daar, lees wat het hulpmiddel zegt te gaan bouwen en vergelijk dat met de instellingen op deze pagina.
Scripts-redding zit in het Pro-abonnement. Er wordt niets gepubliceerd totdat je vertelt wat je oude Script gaf en beide bedragen tot op de cent kloppen.
Het Script
Nog niet mogelijkREJECTION_MESSAGE = "Discount codes cannot be used during a sale"
unless Input.cart.discount_code.nil?
Input.cart.discount_code.reject(message: REJECTION_MESSAGE)
end
Output.cart = Input.cartWe have not built this yet
Your Script turned away a discount code the shopper typed. Shopify allows that only from an automatic discount, so we can rebuild it if this campaign runs automatically rather than on its own code.
Dit is ons gat, niet dat van Shopify. Shopify staat het toe en wij hebben het niet gebouwd, dus er valt hier niets te linken en niets op het platform af te schuiven.
Redensleutel: unsupported.rejectDiscountCodeOnCodeCampaign
Er is hier geen winkelwagen om te testen, want er wordt niets gebouwd. Dit plakken levert de melding hierboven op en verder geen campagne.
Veelgestelde vragen
- Will Stackable rebuild this script?
- No, and the reason is stated rather than hidden: Your Script turned away a discount code the shopper typed. Shopify allows that only from an automatic discount, so we can rebuild it if this campaign runs automatically rather than on its own code.
Verwante Script-vormen
Script logic that only ran when the shopper had typed a particular code.
A whole family of codes driving one rule through a prefix match.
Plak je Script en zie het herbouwd worden
De herbouw wordt getoetst aan het bedrag dat je oude Script rekende voordat je hem kunt publiceren.