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.
Ainda sem suporteIt ran several separate campaigns over the same cart, one after another.
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
Ainda sem suporte# 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.
Essa falta é nossa, não da Shopify. A Shopify permite e nós não construímos, então não há nada para linkar aqui e nada para culpar na plataforma.
Chave do motivo: unsupported.multiCampaign
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: 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.
Formatos de Script relacionados
A paste that lost its instance variables on the way through a forum post.
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.