Migrating a lifetime spend discount script
The same shape as the order-count gate and the same plumbing behind it, asked for less often. Both are worth reading together, because the answer for one is the answer for the other.
Non ancora supportatoIt checked how much the customer had spent in total before applying the discount.
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 supportatoLIFETIME_SPEND = Money.new(cents: 50000)
DISCOUNT_PERCENTAGE = 10
if !Input.cart.customer.nil? && Input.cart.customer.total_spent >= LIFETIME_SPEND
Input.cart.line_items.each do |line_item|
line_item.change_line_price(
line_item.line_price * (1.0 - (DISCOUNT_PERCENTAGE / 100.0)),
message: "Loyalty discount"
)
end
end
Output.cart = Input.cartWe have not built this yet
Your Script checked how much the customer had spent in total. 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.customerTotalSpent
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 much the customer had spent in total. 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 new-customer gate wrapped around a cheapest-item reward.
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.