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.
Andet Shopify-APIIt deleted matching payment gateways from the list checkout offered.
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-APIHIDDEN_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
endThis 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.
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.paymentCustomization
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 hid, renamed, or reordered payment methods. Shopify builds that with the Payment Customization 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.
Products that could not ship to the shopper’s country, quietly deleted.
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.