Migrating a line item property script
Personalisation, gift wrap and landing-page attribution all attach data to a single cart line rather than to the cart. Cart attributes and line properties look alike in a merchant’s description and are different fields.
未対応It read a custom property attached to a single cart line and branched on it.
スクリプトレスキューに貼り付けて、何が再現されるか確認する
- このページの各スクリプトの横にあるボタンで Ruby をコピーします。
- Shopify 管理画面で Stackable を開き、ツール、スクリプトレスキューの順に進みます。
- そこに貼り付け、ツールが作成すると示した内容を読み、このページの設定と見比べます。
スクリプトレスキューは Pro プランの機能です。以前のスクリプトの割引額を入力し、両方の金額が最小通貨単位まで一致するまで、何も公開されません。
Script 本体
未対応DISCOUNT_PERCENTAGE = 10
Input.cart.line_items.each do |line_item|
next unless line_item.properties.has_key?("_ref")
next unless line_item.properties["_ref"] == "landing-page-a"
line_item.change_line_price(
line_item.line_price * (1.0 - (DISCOUNT_PERCENTAGE / 100.0)),
message: "Landing page offer"
)
end
Output.cart = Input.cartWe have not built this yet
Your Script read a property on one line, such as an engraving or a delivery date. We only read properties on the whole cart today.
これは Shopify ではなく当社の不足です。Shopify では許可されていますが当社が未実装なので、リンクできる先はなく、プラットフォームのせいにできる点もありません。
理由キー: unsupported.lineItemProperty
何も作成されないため、ここに検証できるカートはありません。これを貼り付けても上のメッセージが出るだけで、キャンペーンは作成されません。
よくある質問
- Will Stackable rebuild this script?
- No, and the reason is stated rather than hidden: Your Script read a property on one line, such as an engraving or a delivery date. We only read properties on the whole cart today.
関連する Script の型
A discount limited to products carrying one tag, vendor or type.
Already-marked-down products protected from a second discount.
Gift cards left out of a discount that would otherwise have hit them.