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.
Ikke understøttet endnuIt rejected the discount code the shopper had entered and showed them a reason.
Indsæt det i Scripts-redning, og se hvad der bliver bygget
- Kopiér Ruby-koden med knappen ved siden af ethvert Script på siden.
- Åbn Stackable i Shopify-administrationen, derefter Værktøjer og så Scripts-redning.
- Indsæt det der, læs hvad værktøjet siger, det vil bygge, og hold det op mod indstillingerne på denne side.
Scripts-redning hører til Pro-abonnementet. Intet bliver udgivet, før du oplyser, hvad dit gamle Script gav i rabat, og de to beløb stemmer helt ned på øret.
Selve dette Script
Ikke understøttet endnuREJECTION_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.
Det her er vores hul, ikke Shopifys. Shopify tillader det, og vi har ikke bygget det, så der er intet at linke til her og intet at skyde på platformen.
Årsagsnøgle: unsupported.rejectDiscountCodeOnCodeCampaign
Der er ingen kurv at teste her, fordi der ikke bliver bygget noget. At indsætte det her giver beskeden ovenfor og slet ingen kampagne.
Ofte stillede spørgsmål
- 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.
Beslægtede Script-typer
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.
Indsæt dit Script og se det blive genopbygget
Genopbygningen holdes op mod det beløb, dit gamle Script opkrævede, før du kan udgive den.