A Shopify Script copied out of a forum thread
A real hazard for any tool whose entire input is a paste. Forum software reads an at sign as a mention and swallows the variable name, so a script that looks complete has had its data silently removed.
Controlla il testoNothing different from the original. The copy that reached us had lost the variables the original depended on.
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
Controlla il testo = tiers.sort_by { |tier| tier[:quantity] }.reverse
_type = :percent
_message = "Bulk discount"
Input.cart.line_items.each do |line_item|
.each do |tier|
if line_item.quantity >= tier[:quantity]
line_item.change_line_price(line_item.line_price * (1 - (tier[:discount] / 100.0)), message: _message)
break
end
end
end
Output.cart = Input.cartWe could not read this copy of your Script
Parts of this paste are missing. Community forum posts swallow Ruby variables that start with an at sign, so a Script copied back out of a forum thread is not what the Script said. Paste the original file from your own backup or version control.
Il tuo Script probabilmente va benissimo. Quello che non va è la copia che arriva allo strumento, e da un file danneggiato non tirerà a indovinare i prezzi.
Chiave del motivo: input.corruptedPaste
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: Parts of this paste are missing. Community forum posts swallow Ruby variables that start with an at sign, so a Script copied back out of a forum thread is not what the Script said. Paste the original file from your own backup or version control.
Forme di Script correlate
One file holding several separate rules that ran one after another.
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.