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

Migrating the 20 percent off first time customers script

The clearest illustration of why a migration tool has to refuse a partial answer. The reward half is perfectly readable and the condition half is not, and rebuilding the reward alone would hand every shopper a permanent discount.

未対応
この Script がしていたこと

It gave a percentage off the cheapest item, but only to shoppers who had never ordered before.

自分のストアで試す

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

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

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

Script 本体

未対応
元の Ruby

DISCOUNT_AMOUNT = 20

if Input.cart.line_items.size > 1 && (Input.cart.customer.nil? || Input.cart.customer.orders_count < 1)
  line_item = Input.cart.line_items.sort_by { |li| li.variant.price }.first
  if line_item.quantity > 1
    line_item = line_item.split(take: 1)
    Input.cart.line_items << line_item
  end
  line_item.change_line_price(
    line_item.line_price * (1.0 - (DISCOUNT_AMOUNT / 100.0)),
    message: "20% off for first time customers"
  )
end

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

We have not built this yet

Your Script checked how many orders the customer had placed. Shopify can tell us, but our checkout query is already at Shopify's cost limit, so we cannot ask for it today.

これは Shopify ではなく当社の不足です。Shopify では許可されていますが当社が未実装なので、リンクできる先はなく、プラットフォームのせいにできる点もありません。

理由キー: unsupported.customerOrderCount

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

よくある質問

Will Stackable rebuild this script?
No, and the reason is stated rather than hidden: Your Script checked how many orders the customer had placed. Shopify can tell us, but our checkout query is already at Shopify's cost limit, so we cannot ask for it today.

関連する Script の型

First order discount

A discount for shoppers with no order history, or with enough of it.

Lifetime spend discount

A reward for customers who had spent enough over their lifetime.

Customer tag discount

A discount only tagged customers ever saw.

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

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

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