Migrating a remove products from the cart script
A restriction enforced by deletion. The behaviour that replaces it is arguably better, because it tells the shopper what happened rather than making an item vanish between the cart and checkout.
另一种 Shopify APIIt deleted lines from certain vendors when the cart was shipping to a listed country.
把它粘贴到 Scripts 救援,看看会重建成什么
- 用本页任意 Script 旁边的按钮复制 Ruby 代码。
- 在 Shopify 后台打开 Stackable,依次进入工具、Scripts 救援。
- 粘贴进去,读一读工具说它会创建什么,再和本页的设置逐项对照。
Scripts 救援属于 Pro 套餐。在您填写旧 Script 的折扣金额、且两个数字精确到最小货币单位完全一致之前,不会发布任何内容。
Script 本体
另一种 Shopify APIRESTRICTED_VENDORS = ["acme", "globex"]
RESTRICTED_COUNTRIES = ["ca", "au"]
cart = Input.cart
unless cart.shipping_address.nil?
if RESTRICTED_COUNTRIES.include?(cart.shipping_address.country_code.downcase)
cart.line_items.delete_if do |line_item|
RESTRICTED_VENDORS.include?(line_item.variant.product.vendor.downcase)
end
end
end
Output.cart = Input.cartThis needs a different kind of Shopify app
Your Script blocked or limited checkout, such as a purchase limit or an age check. Shopify builds that with the Cart and Checkout Validation API, which Stackable does not ship.
Script 的这一部分不是折扣。Shopify 用上面提到的另一种函数类型来实现它,而 Stackable 并不提供那种函数。
阅读 Shopify 官方文档原因键: otherApi.cartCheckoutValidation
这里没有可供验证的购物车,因为什么都不会生成。粘贴它只会得到上面的提示,不会创建任何活动。
常见问题
- Will Stackable rebuild this script?
- No, and the reason is stated rather than hidden: Your Script blocked or limited checkout, such as a purchase limit or an age check. Shopify builds that with the Cart and Checkout Validation API, which Stackable does not ship.
相关的 Script 类型
A cap on how many units a shopper could buy, enforced by trimming the cart.
A payment option taken off checkout under a condition.