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.
Tjek det indsatteNothing different from the original. The copy that reached us had lost the variables the original depended on.
Indsæt det i Scripts-redning, og se hvad der bliver bygget
- Kopiér Ruby-koden med knappen ved siden af ethvert Script på siden.
- Åbn Stackable i Shopify-administrationen, derefter Værktøjer og så Scripts-redning.
- Indsæt det der, læs hvad værktøjet siger, det vil bygge, og hold det op mod indstillingerne på denne side.
Scripts-redning hører til Pro-abonnementet. Intet bliver udgivet, før du oplyser, hvad dit gamle Script gav i rabat, og de to beløb stemmer helt ned på øret.
Selve dette Script
Tjek det indsatte = 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.
Dit Script fejler sandsynligvis ikke noget. Det gør den kopi, der når frem til værktøjet, og det gætter ikke priser ud fra en beskadiget fil.
Årsagsnøgle: input.corruptedPaste
Der er ingen kurv at teste her, fordi der ikke bliver bygget noget. At indsætte det her giver beskeden ovenfor og slet ingen kampagne.
Ofte stillede spørgsmål
- 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.
Beslægtede Script-typer
One file holding several separate rules that ran one after another.
Indsæt dit Script og se det blive genopbygget
Genopbygningen holdes op mod det beløb, dit gamle Script opkrævede, før du kan udgive den.