Migrating a script that discounted one named shipping rate
Both official Help Center shipping discount examples pick a rate by name, which makes rate-specific targeting the default shape of an official shipping script rather than an unusual one.
未対応It matched delivery rates by name and discounted only the ones that matched.
この処理はマーチャントによって 2 通りの書き方がされており、すべてが同じ意味とは限りません。それぞれの書き方を、専用のカートと数値とともに以下に示します。
スクリプトレスキューに貼り付けて、何が再現されるか確認する
- このページの各スクリプトの横にあるボタンで Ruby をコピーします。
- Shopify 管理画面で Stackable を開き、ツール、スクリプトレスキューの順に進みます。
- そこに貼り付け、ツールが作成すると示した内容を読み、このページの設定と見比べます。
スクリプトレスキューは Pro プランの機能です。以前のスクリプトの割引額を入力し、両方の金額が最小通貨単位まで一致するまで、何も公開されません。
Shipping discount specific rate
未対応ELIGIBLE_SERVICES = ["Standard"]
DISCOUNT_PERCENTAGE = 50
Input.shipping_rates.each do |shipping_rate|
next unless ELIGIBLE_SERVICES.include?(shipping_rate.name)
discount = shipping_rate.price * (DISCOUNT_PERCENTAGE / 100.0)
shipping_rate.apply_discount(discount, message: "50% off Standard shipping")
end
Output.shipping_rates = Input.shipping_ratesWe have not built this yet
Your Script discounted one named shipping rate. We discount every shipping rate or none, so we would discount more than your Script did.
これは Shopify ではなく当社の不足です。Shopify では許可されていますが当社が未実装なので、リンクできる先はなく、プラットフォームのせいにできる点もありません。
理由キー: unsupported.shippingRateName
何も作成されないため、ここに検証できるカートはありません。これを貼り付けても上のメッセージが出るだけで、キャンペーンは作成されません。
Shipping unknown property
未対応Input.shipping_rates.each do |shipping_rate|
if shipping_rate.shipping_method == "Express"
shipping_rate.apply_discount(shipping_rate.price, message: "Free express")
end
end
Output.shipping_rates = Input.shipping_ratesWe have not built this yet
Your Script discounted one named shipping rate. We discount every shipping rate or none, so we would discount more than your Script did.
これは Shopify ではなく当社の不足です。Shopify では許可されていますが当社が未実装なので、リンクできる先はなく、プラットフォームのせいにできる点もありません。
理由キー: unsupported.shippingRateName
何も作成されないため、ここに検証できるカートはありません。これを貼り付けても上のメッセージが出るだけで、キャンペーンは作成されません。
よくある質問
- Will Stackable rebuild this script?
- No, and the reason is stated rather than hidden: Your Script discounted one named shipping rate. We discount every shipping rate or none, so we would discount more than your Script did.
関連する Script の型
A share taken off every delivery rate at checkout.
A flat sum off the delivery charge, floored at free.
Every delivery rate rewritten to one price rather than reduced by an amount.