Migrating a script that held several campaigns
Merchants got one published script per type, so everything went in one file. A tool that reads the first rule and reports success has told you the file is handled when three quarters of it is not.
Ikke understøttet endnuIt ran several separate campaigns over the same cart, one after another.
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
Ikke understøttet endnu# GENERATED BY THE SHOPIFY SCRIPT CREATOR APP
# Version 0.12.0
class Campaign
def initialize(condition, *qualifiers)
@condition = (condition.to_s + '?').to_sym
@qualifiers = PostCartAmountQualifier ? [] : [] rescue qualifiers.compact
end
def qualifies?(cart)
return true if @qualifiers.empty?
end
end
CAMPAIGNS = [
ConditionalDiscount.new(
:all, nil, nil,
ProductTagSelector.new(:does, :match, ["sale"]),
PercentageDiscount.new(20, "20% off sale"),
0
),
ConditionalDiscount.new(
:all, nil, nil,
ProductVendorSelector.new(:does, ["Acme"]),
PercentageDiscount.new(15, "15% off Acme"),
0
),
QuantityTierDiscount.new(
:all, nil, nil,
:line_quantity,
[{tier: "5", discount: "10", message: "Buy 5+"}],
0
),
ConditionalDiscount.new(
:all,
CustomerTagQualifier.new(:does, :match, ["VIP"]),
nil, nil,
PercentageDiscount.new(25, "VIP 25% off"),
0
),
].freeze
CAMPAIGNS.each do |campaign|
campaign.run(Input.cart)
end
Output.cart = Input.cartWe have not built this yet
This file holds several campaigns merged together, and the Script kept whichever gave the better price. We will not collapse them into one offer. Split them up and we can rebuild each one.
Det her er vores hul, ikke Shopifys. Shopify tillader det, og vi har ikke bygget det, så der er intet at linke til her og intet at skyde på platformen.
Årsagsnøgle: unsupported.multiCampaign
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: This file holds several campaigns merged together, and the Script kept whichever gave the better price. We will not collapse them into one offer. Split them up and we can rebuild each one.
Beslægtede Script-typer
A paste that lost its instance variables on the way through a forum post.
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.