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

Migrating a free shipping for certain products script

There is a single word in this template that changes the offer completely. After discounting the first paid rate it breaks out of the loop, so every other rate stays full price. A reader who skims the loop makes them all free.

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

It made the first paid delivery rate free when the cart contained a product carrying a particular tag.

自分のストアで試す

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

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

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

Script 本体

未対応
元の Ruby

FREE_TAG = 'freeship'

if Input.cart.shipping_address.country_code == 'US' && Input.cart.line_items.any? { |item| item.variant.product.tags.include? FREE_TAG }
  Input.shipping_rates.each do |shipping_rate|
    next if shipping_rate.price == Money.zero
    shipping_rate.apply_discount(shipping_rate.price, message: "Free Shipping!")
    break
  end
end

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

We have not built this yet

Your Script decided free shipping from what was in the cart. Our free shipping is decided by what the cart is worth.

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

理由キー: unsupported.shippingProductCondition

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

よくある質問

Will Stackable rebuild this script?
No, and the reason is stated rather than hidden: Your Script decided free shipping from what was in the cart. Our free shipping is decided by what the cart is worth.

関連する Script の型

Percentage off shipping

A share taken off every delivery rate at checkout.

Amount off shipping

A flat sum off the delivery charge, floored at free.

Flat rate shipping

Every delivery rate rewritten to one price rather than reduced by an amount.

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

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

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