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.
Vérifiez le collageNothing different from the original. The copy that reached us had lost the variables the original depended on.
Collez-le dans Sauvetage des Scripts et regardez ce qu'il reconstruit
- Copiez le Ruby avec le bouton placé à côté de chaque Script de cette page.
- Dans votre interface Shopify, ouvrez Stackable, puis Outils, puis Sauvetage des Scripts.
- Collez-le, lisez ce que l'outil annonce qu'il va construire et comparez-le aux réglages de cette page.
Sauvetage des Scripts fait partie du forfait Pro. Rien n'est publié tant que vous n'avez pas indiqué la remise de votre ancien Script et que les deux chiffres ne correspondent pas au centime près.
Le Script
Vérifiez le collage = 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.
Votre Script est probablement très bien. La copie qui parvient à l'outil ne l'est pas, et il ne devinera pas les prix à partir d'un fichier abîmé.
Clé du motif : input.corruptedPaste
Il n'y a pas de panier à tester ici, puisque rien n'est construit. Coller ceci produit le message ci-dessus et aucune campagne.
Questions fréquentes
- 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.
Formes de Script apparentées
One file holding several separate rules that ran one after another.
Collez votre Script et voyez sa reconstruction
La reconstruction est comparée au montant que facturait votre ancien Script avant que vous puissiez la publier.