コンテンツにスキップ
Script 実例集

A Shopify Script copied out of a forum thread

A real hazard for any tool whose entire input is a paste. Forum software reads an at sign as a mention and swallows the variable name, so a script that looks complete has had its data silently removed.

貼り付けを確認
この Script がしていたこと

Nothing different from the original. The copy that reached us had lost the variables the original depended on.

自分のストアで試す

スクリプトレスキューに貼り付けて、何が再現されるか確認する

  1. このページの各スクリプトの横にあるボタンで Ruby をコピーします。
  2. Shopify 管理画面で Stackable を開き、ツール、スクリプトレスキューの順に進みます。
  3. そこに貼り付け、ツールが作成すると示した内容を読み、このページの設定と見比べます。

スクリプトレスキューは Pro プランの機能です。以前のスクリプトの割引額を入力し、両方の金額が最小通貨単位まで一致するまで、何も公開されません。

Script 本体

貼り付けを確認
元の Ruby

 = tiers.sort_by { |tier| tier[:quantity] }.reverse
_type = :percent
_message = "Bulk discount"

Input.cart.line_items.each do |line_item|
  .each do |tier|
    if line_item.quantity >= tier[:quantity]
      line_item.change_line_price(line_item.line_price * (1 - (tier[:discount] / 100.0)), message: _message)
      break
    end
  end
end

Output.cart = Input.cart
これはどうなるか

We could not read this copy of your Script

Parts of this paste are missing. Community forum posts swallow Ruby variables that start with an at sign, so a Script copied back out of a forum thread is not what the Script said. Paste the original file from your own backup or version control.

Script 自体には問題がない可能性が高いです。問題はツールに届いたコピーの方で、壊れたファイルから価格を推測することはしません。

理由キー: input.corruptedPaste

何も作成されないため、ここに検証できるカートはありません。これを貼り付けても上のメッセージが出るだけで、キャンペーンは作成されません。

よくある質問

Will Stackable rebuild this script?
No, and the reason is stated rather than hidden: Parts of this paste are missing. Community forum posts swallow Ruby variables that start with an at sign, so a Script copied back out of a forum thread is not what the Script said. Paste the original file from your own backup or version control.

関連する Script の型

Several campaigns in one file

One file holding several separate rules that ran one after another.

Script を貼り付けて再構築を確認

再構築の結果は、公開する前に、以前の Script が請求していた金額と照合されます。

本サイトの運営には必須Cookieを使用しており、お客様の同意をいただいた場合のみ、アクセス状況を把握するための分析Cookieを使用します。詳細は Cookieポリシー.