Hoppa till innehåll
Script-exempel

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.

Stöds inte än
Vad detta Script gjorde

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

Testa det i din egen butik

Klistra in det i Scripts-räddning och se vad som byggs

  1. Kopiera Ruby-koden med knappen bredvid vilket Script som helst på sidan.
  2. Öppna Stackable i Shopify-adminen, sedan Verktyg, sedan Scripts-räddning.
  3. Klistra in det där, läs vad verktyget säger att det ska bygga och jämför med inställningarna på den här sidan.

Scripts-räddning ingår i Pro-planen. Ingenting publiceras förrän du anger vad ditt gamla Script gav i rabatt och båda beloppen stämmer på öret.

Detta Script

Stöds inte än
Den ursprungliga Ruby-koden

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
Vad som händer med den här

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 här är vår lucka, inte Shopifys. Shopify tillåter det och vi har inte byggt det, så det finns inget att länka till här och inget att skylla på plattformen.

Orsaksnyckel: unsupported.rejectDiscountCodeOnCodeCampaign

Det finns ingen varukorg att testa här, eftersom ingenting byggs. Att klistra in det här ger meddelandet ovan och ingen kampanj alls.

Vanliga frågor

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äktade Script-former

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.

Klistra in ditt Script och se det byggas om

Ombyggnaden stäms av mot beloppet som ditt gamla Script tog ut innan du kan publicera den.

Vi använder nödvändiga cookies för att driva den här webbplatsen, och, bara med ditt tillstånd, analyscookies för att förstå trafiken. Läs vår Cookiepolicy.