Migrating the 20 percent off first time customers script
The clearest illustration of why a migration tool has to refuse a partial answer. The reward half is perfectly readable and the condition half is not, and rebuilding the reward alone would hand every shopper a permanent discount.
Non ancora supportatoIt gave a percentage off the cheapest item, but only to shoppers who had never ordered before.
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 supportatoDISCOUNT_AMOUNT = 20
if Input.cart.line_items.size > 1 && (Input.cart.customer.nil? || Input.cart.customer.orders_count < 1)
line_item = Input.cart.line_items.sort_by { |li| li.variant.price }.first
if line_item.quantity > 1
line_item = line_item.split(take: 1)
Input.cart.line_items << line_item
end
line_item.change_line_price(
line_item.line_price * (1.0 - (DISCOUNT_AMOUNT / 100.0)),
message: "20% off for first time customers"
)
end
Output.cart = Input.cartWe have not built this yet
Your Script checked how many orders the customer had placed. Shopify can tell us, but our checkout query is already at Shopify's cost limit, so we cannot ask for it today.
È 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.customerOrderCount
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 checked how many orders the customer had placed. Shopify can tell us, but our checkout query is already at Shopify's cost limit, so we cannot ask for it today.
Forme di Script correlate
A discount for shoppers with no order history, or with enough of it.
A reward for customers who had spent enough over their lifetime.
A discount only tagged customers ever saw.
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.