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.
Controleer je plakselNothing different from the original. The copy that reached us had lost the variables the original depended on.
Plak het in Scripts-redding en kijk wat eruit komt
- Kopieer de Ruby met de knop naast elk Script op deze pagina.
- Open in je Shopify-beheer Stackable, dan Hulpmiddelen, dan Scripts-redding.
- Plak het daar, lees wat het hulpmiddel zegt te gaan bouwen en vergelijk dat met de instellingen op deze pagina.
Scripts-redding zit in het Pro-abonnement. Er wordt niets gepubliceerd totdat je vertelt wat je oude Script gaf en beide bedragen tot op de cent kloppen.
Het Script
Controleer je plaksel = 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.
Met je Script is waarschijnlijk niets mis. Met de kopie die bij de tool aankomt wel, en die gaat geen prijzen raden uit een beschadigd bestand.
Redensleutel: input.corruptedPaste
Er is hier geen winkelwagen om te testen, want er wordt niets gebouwd. Dit plakken levert de melding hierboven op en verder geen campagne.
Veelgestelde vragen
- 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.
Verwante Script-vormen
One file holding several separate rules that ran one after another.
Plak je Script en zie het herbouwd worden
De herbouw wordt getoetst aan het bedrag dat je oude Script rekende voordat je hem kunt publiceren.