Migrating an exclude subscription items script
The stakes are higher here than anywhere else in the library. A one-off discount applied to a wrong line is one order; a subscription priced wrong is every renewal until somebody notices.
Stöds inte änIt skipped any line that had been added on a selling plan.
Klistra in det i Scripts-räddning och se vad som byggs
- Kopiera Ruby-koden med knappen bredvid vilket Script som helst på sidan.
- Öppna Stackable i Shopify-adminen, sedan Verktyg, sedan Scripts-räddning.
- 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 änDISCOUNT_PERCENTAGE = 20
Input.cart.line_items.each do |line_item|
next unless line_item.selling_plan_id.nil?
line_item.change_line_price(
line_item.line_price * (1.0 - (DISCOUNT_PERCENTAGE / 100.0)),
message: "20% off one-time purchases"
)
end
Output.cart = Input.cartWe have not built this yet
Your Script treated subscription items differently. Shopify does tell us which items are subscriptions, but our checkout query is already at Shopify's cost limit, so we cannot ask for it today.
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.subscriptionExclusion
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 treated subscription items differently. Shopify does tell us which items are subscriptions, but our checkout query is already at Shopify's cost limit, so we cannot ask for it today.
Besläktade Script-former
A discount limited to products carrying one tag, vendor or type.
Already-marked-down products protected from a second discount.
Gift cards left out of a discount that would otherwise have hit them.
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.