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.
Noch nicht möglichIt ran several separate campaigns over the same cart, one after another.
Fügen Sie es in die Scripts-Rettung ein und sehen Sie, was daraus wird
- Kopieren Sie das Ruby mit der Schaltfläche neben jedem Script auf dieser Seite.
- Öffnen Sie im Shopify-Adminbereich Stackable, dann Tools, dann Scripts-Rettung.
- Fügen Sie es dort ein, lesen Sie, was das Tool bauen will, und vergleichen Sie das mit den Einstellungen auf dieser Seite.
Die Scripts-Rettung gehört zum Pro-Tarif. Nichts wird veröffentlicht, bevor Sie angeben, was Ihr altes Script berechnet hat, und beide Zahlen auf den Cent genau übereinstimmen.
Das Script
Noch nicht möglich# 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.
Das ist unsere Lücke, nicht die von Shopify. Shopify erlaubt es, und wir haben es nicht gebaut. Es gibt hier also nichts zu verlinken und nichts, was man der Plattform anlasten könnte.
Grundschlüssel: unsupported.multiCampaign
Hier gibt es keinen Warenkorb zum Testen, weil nichts gebaut wird. Das Einfügen erzeugt die obige Meldung und überhaupt keine Kampagne.
Häufige Fragen
- 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.
Verwandte Script-Formen
A paste that lost its instance variables on the way through a forum post.
Fügen Sie Ihr Script ein und sehen Sie den Nachbau
Der Nachbau wird mit dem Betrag abgeglichen, den Ihr altes Script berechnet hat, bevor Sie ihn veröffentlichen können.