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

Migrating a hide payment method script

Worth noticing that the show-a-gateway examples do not add anything: they delete everything that does not match. Show and hide are the same operation with the predicate flipped, and both end up in the same place.

別の Shopify API
この Script がしていたこと

It deleted matching payment gateways from the list checkout offered.

自分のストアで試す

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

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

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

Script 本体

別の Shopify API
元の Ruby

HIDDEN_GATEWAY = "Cash on Delivery"
THRESHOLD = Money.new(cents: 5000)

if Input.cart.subtotal_price < THRESHOLD
  Output.payment_gateways = Input.payment_gateways.delete_if do |payment_gateway|
    payment_gateway.name == HIDDEN_GATEWAY
  end
else
  Output.payment_gateways = Input.payment_gateways
end
これはどうなるか

This needs a different kind of Shopify app

Your Script hid, renamed, or reordered payment methods. Shopify builds that with the Payment Customization API, which Stackable does not ship.

Script のこの部分は割引ではありません。Shopify は上に挙げた別の種類の関数でこれを実現しますが、Stackable はそれを提供していません。

Shopify のドキュメントを読む

理由キー: otherApi.paymentCustomization

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

よくある質問

Will Stackable rebuild this script?
No, and the reason is stated rather than hidden: Your Script hid, renamed, or reordered payment methods. Shopify builds that with the Payment Customization API, which Stackable does not ship.

関連する Script の型

Purchase quantity limit

A cap on how many units a shopper could buy, enforced by trimming the cart.

Remove products by country

Products that could not ship to the shopper’s country, quietly deleted.

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

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

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