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.
Non ancora supportatoIt made the first paid delivery rate free when the cart contained a product carrying a particular tag.
Incollalo in Recupero Script e guarda cosa ricostruisce
- Copia il Ruby con il pulsante accanto a ogni Script di questa pagina.
- Nell'admin di Shopify apri Stackable, poi Strumenti, poi Recupero Script.
- Incollalo lì, leggi cosa dichiara di costruire lo strumento e confrontalo con le impostazioni di questa pagina.
Recupero Script è nel piano Pro. Non viene pubblicato nulla finché non dichiari quanto scontava il vecchio Script e le due cifre non coincidono al centesimo.
Lo Script
Non ancora supportatoFREE_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_ratesWe 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.
È una mancanza nostra, non di Shopify. Shopify lo consente e noi non lo abbiamo realizzato, quindi qui non c'è niente da collegare e niente da addossare alla piattaforma.
Chiave del motivo: unsupported.shippingProductCondition
Qui non c'è nessun carrello da testare, perché non viene creato nulla. Incollando questo compare il messaggio qui sopra e nessuna campagna.
Domande frequenti
- 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.
Forme di Script correlate
A share taken off every delivery rate at checkout.
A flat sum off the delivery charge, floored at free.
Every delivery rate rewritten to one price rather than reduced by an amount.
Incolla il tuo Script e guardalo ricostruito
La ricostruzione viene confrontata con l'importo che il tuo vecchio Script applicava, prima che tu possa pubblicarla.