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.
Nog niet mogelijkIt gave a percentage off the cheapest item, but only to shoppers who had never ordered before.
Plak het in Scripts-redding en kijk wat eruit komt
- Kopieer de Ruby met de knop naast elk Script op deze pagina.
- Open in je Shopify-beheer Stackable, dan Hulpmiddelen, dan Scripts-redding.
- Plak het daar, lees wat het hulpmiddel zegt te gaan bouwen en vergelijk dat met de instellingen op deze pagina.
Scripts-redding zit in het Pro-abonnement. Er wordt niets gepubliceerd totdat je vertelt wat je oude Script gaf en beide bedragen tot op de cent kloppen.
Het Script
Nog niet mogelijkDISCOUNT_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.
Dit is ons gat, niet dat van Shopify. Shopify staat het toe en wij hebben het niet gebouwd, dus er valt hier niets te linken en niets op het platform af te schuiven.
Redensleutel: unsupported.customerOrderCount
Er is hier geen winkelwagen om te testen, want er wordt niets gebouwd. Dit plakken levert de melding hierboven op en verder geen campagne.
Veelgestelde vragen
- 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.
Verwante Script-vormen
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.
Plak je Script en zie het herbouwd worden
De herbouw wordt getoetst aan het bedrag dat je oude Script rekende voordat je hem kunt publiceren.