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.
Nog niet mogelijkIt ran several separate campaigns over the same cart, one after another.
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
Nog niet mogelijk# 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.
Dit is ons gat, niet dat van Shopify. Shopify staat het toe en wij hebben het niet gebouwd, dus er valt hier niets te linken en niets op het platform af te schuiven.
Redensleutel: unsupported.multiCampaign
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: 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.
Verwante Script-vormen
A paste that lost its instance variables on the way through a forum post.
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.