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

Migrating a reject discount code script

This one changed under everyone’s feet. Rejecting a typed code was impossible for a discount function until December 2025 and is possible now, with one restriction that decides whether your file can be rebuilt.

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

It rejected the discount code the shopper had entered and showed them a reason.

自分のストアで試す

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

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

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

Script 本体

未対応
元の Ruby

REJECTION_MESSAGE = "Discount codes cannot be used during a sale"

unless Input.cart.discount_code.nil?
  Input.cart.discount_code.reject(message: REJECTION_MESSAGE)
end

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

We have not built this yet

Your Script turned away a discount code the shopper typed. Shopify allows that only from an automatic discount, so we can rebuild it if this campaign runs automatically rather than on its own code.

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

理由キー: unsupported.rejectDiscountCodeOnCodeCampaign

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

よくある質問

Will Stackable rebuild this script?
No, and the reason is stated rather than hidden: Your Script turned away a discount code the shopper typed. Shopify allows that only from an automatic discount, so we can rebuild it if this campaign runs automatically rather than on its own code.

関連する Script の型

Discount code driven

Script logic that only ran when the shopper had typed a particular code.

Discount code pattern

A whole family of codes driving one rule through a prefix match.

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

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

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