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.
Non ancora supportatoIt rejected the discount code the shopper had entered and showed them a reason.
Incollalo in Recupero Script e guarda cosa ricostruisce
- Copia il Ruby con il pulsante accanto a ogni Script di questa pagina.
- Nell'admin di Shopify apri Stackable, poi Strumenti, poi Recupero Script.
- Incollalo lì, leggi cosa dichiara di costruire lo strumento e confrontalo con le impostazioni di questa pagina.
Recupero Script è nel piano Pro. Non viene pubblicato nulla finché non dichiari quanto scontava il vecchio Script e le due cifre non coincidono al centesimo.
Lo Script
Non ancora supportatoREJECTION_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.
È una mancanza nostra, non di Shopify. Shopify lo consente e noi non lo abbiamo realizzato, quindi qui non c'è niente da collegare e niente da addossare alla piattaforma.
Chiave del motivo: unsupported.rejectDiscountCodeOnCodeCampaign
Qui non c'è nessun carrello da testare, perché non viene creato nulla. Incollando questo compare il messaggio qui sopra e nessuna campagna.
Domande frequenti
- 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.
Forme di Script correlate
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.
Incolla il tuo Script e guardalo ricostruito
La ricostruzione viene confrontata con l'importo che il tuo vecchio Script applicava, prima che tu possa pubblicarla.