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.
Andet Shopify-APIIt deleted lines from certain vendors when the cart was shipping to a listed country.
Indsæt det i Scripts-redning, og se hvad der bliver bygget
- Kopiér Ruby-koden med knappen ved siden af ethvert Script på siden.
- Åbn Stackable i Shopify-administrationen, derefter Værktøjer og så Scripts-redning.
- Indsæt det der, læs hvad værktøjet siger, det vil bygge, og hold det op mod indstillingerne på denne side.
Scripts-redning hører til Pro-abonnementet. Intet bliver udgivet, før du oplyser, hvad dit gamle Script gav i rabat, og de to beløb stemmer helt ned på øret.
Selve dette Script
Andet 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.
Denne del af et Script er ikke en rabat. Shopify bygger den med en anden funktionstype, nævnt ovenfor, som Stackable ikke leverer.
Læs Shopifys dokumentationÅrsagsnøgle: otherApi.cartCheckoutValidation
Der er ingen kurv at teste her, fordi der ikke bliver bygget noget. At indsætte det her giver beskeden ovenfor og slet ingen kampagne.
Ofte stillede spørgsmål
- 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.
Beslægtede Script-typer
A cap on how many units a shopper could buy, enforced by trimming the cart.
A payment option taken off checkout under a condition.
Indsæt dit Script og se det blive genopbygget
Genopbygningen holdes op mod det beløb, dit gamle Script opkrævede, før du kan udgive den.