Spring til indhold
Script-eksempler

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 endnu
Hvad dette Script gjorde

It rejected the discount code the shopper had entered and showed them a reason.

Prøv det i din egen butik

Indsæt det i Scripts-redning, og se hvad der bliver bygget

  1. Kopiér Ruby-koden med knappen ved siden af ethvert Script på siden.
  2. Åbn Stackable i Shopify-administrationen, derefter Værktøjer og så Scripts-redning.
  3. 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 endnu
Den oprindelige Ruby-kode

REJECTION_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.cart
Hvad der sker med denne

We 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

Discount code driven

Script logic that only ran when the shopper had typed a particular code.

Discount code pattern

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.

Vi bruger essentielle cookies til at drive dette site, og kun med din tilladelse, analysecookies til at forstå trafik. Læs vores Cookiepolitik.