跳转到主要内容
Script 示例

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.

尚未支持
这个 Script 做了什么

It ran several separate campaigns over the same cart, one after another.

在您自己的店铺里试一试

把它粘贴到 Scripts 救援,看看会重建成什么

  1. 用本页任意 Script 旁边的按钮复制 Ruby 代码。
  2. 在 Shopify 后台打开 Stackable,依次进入工具、Scripts 救援。
  3. 粘贴进去,读一读工具说它会创建什么,再和本页的设置逐项对照。

Scripts 救援属于 Pro 套餐。在您填写旧 Script 的折扣金额、且两个数字精确到最小货币单位完全一致之前,不会发布任何内容。

Script 本体

尚未支持
原始 Ruby

# 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.cart
这一个会怎样

We 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.

这是我们的缺失,不是 Shopify 的。Shopify 允许这么做,我们还没有实现,所以这里没有可链接的内容,也没有理由怪平台。

原因键: unsupported.multiCampaign

这里没有可供验证的购物车,因为什么都不会生成。粘贴它只会得到上面的提示,不会创建任何活动。

常见问题

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.

相关的 Script 类型

Copied from a forum thread

A paste that lost its instance variables on the way through a forum post.

粘贴您的 Script,看看它如何被重建

在您发布之前,重建结果会与原来的 Script 收取的金额进行核对。

我们使用必要 Cookie 来运行本网站,并仅在获得你许可的情况下,使用分析 Cookie 来了解访问情况。详见我们的 Cookie 政策.