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.
Confira o texto coladoNothing different from the original. The copy that reached us had lost the variables the original depended on.
Cole no Resgate de Scripts e veja o que ele reconstrói
- Copie o Ruby no botão ao lado de qualquer Script desta página.
- No admin da Shopify, abra o Stackable, depois Ferramentas e depois Resgate de Scripts.
- Cole lá, leia o que a ferramenta diz que vai criar e compare com as configurações desta página.
O Resgate de Scripts está no plano Pro. Nada é publicado até você informar quanto o Script antigo descontava e os dois valores baterem no centavo.
O Script
Confira o texto colado = 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.
É bem provável que o seu Script esteja certo. Quem não está é a cópia que chega à ferramenta, e ela não vai adivinhar preços a partir de um arquivo danificado.
Chave do motivo: input.corruptedPaste
Não há carrinho para testar aqui, porque nada é criado. Colar isso produz a mensagem acima e nenhuma campanha.
Perguntas frequentes
- 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.
Formatos de Script relacionados
One file holding several separate rules that ran one after another.
Cole o seu Script e veja a reconstrução
A reconstrução é comparada com o valor que o seu Script antigo cobrava antes de você poder publicá-la.