Spring til indhold
Script-eksempler

Migrating a free shipping for certain products script

There is a single word in this template that changes the offer completely. After discounting the first paid rate it breaks out of the loop, so every other rate stays full price. A reader who skims the loop makes them all free.

Ikke understøttet endnu
Hvad dette Script gjorde

It made the first paid delivery rate free when the cart contained a product carrying a particular tag.

Prøv det i din egen butik

Indsæt det i Scripts-redning, og se hvad der bliver bygget

  1. Kopiér Ruby-koden med knappen ved siden af ethvert Script på siden.
  2. Åbn Stackable i Shopify-administrationen, derefter Værktøjer og så Scripts-redning.
  3. 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

Ikke understøttet endnu
Den oprindelige Ruby-kode

FREE_TAG = 'freeship'

if Input.cart.shipping_address.country_code == 'US' && Input.cart.line_items.any? { |item| item.variant.product.tags.include? FREE_TAG }
  Input.shipping_rates.each do |shipping_rate|
    next if shipping_rate.price == Money.zero
    shipping_rate.apply_discount(shipping_rate.price, message: "Free Shipping!")
    break
  end
end

Output.shipping_rates = Input.shipping_rates
Hvad der sker med denne

We have not built this yet

Your Script decided free shipping from what was in the cart. Our free shipping is decided by what the cart is worth.

Det her er vores hul, ikke Shopifys. Shopify tillader det, og vi har ikke bygget det, så der er intet at linke til her og intet at skyde på platformen.

Årsagsnøgle: unsupported.shippingProductCondition

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 decided free shipping from what was in the cart. Our free shipping is decided by what the cart is worth.

Beslægtede Script-typer

Percentage off shipping

A share taken off every delivery rate at checkout.

Amount off shipping

A flat sum off the delivery charge, floored at free.

Flat rate shipping

Every delivery rate rewritten to one price rather than reduced by an amount.

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.

Vi bruger essentielle cookies til at drive dette site, og kun med din tilladelse, analysecookies til at forstå trafik. Læs vores Cookiepolitik.