Saltar al contenido
Ejemplos de Scripts

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.

Aún no admitido
Qué hacía el Script

It checked how much the customer had spent in total before applying the discount.

Pruébalo en tu propia tienda

Pégalo en Rescate de scripts y mira qué reconstruye

  1. Copia el Ruby con el botón que hay junto a cualquier Script de esta página.
  2. En tu panel de Shopify, abre Stackable, luego Herramientas y luego Rescate de scripts.
  3. Pégalo ahí, lee lo que la herramienta dice que va a crear y compáralo con los ajustes de esta página.

Rescate de scripts está en el plan Pro. No se publica nada hasta que le digas cuánto descontaba tu Script antiguo y las dos cifras coincidan al céntimo.

El Script

Aún no admitido
El Ruby original

LIFETIME_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.cart
Qué pasa con este

We 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.

Es una carencia nuestra, no de Shopify. Shopify lo permite y nosotros no lo hemos construido, así que aquí no hay nada que enlazar ni nada que echarle a la plataforma.

Clave del motivo: unsupported.customerTotalSpent

Aquí no hay carrito que probar, porque no se construye nada. Pegar esto produce el mensaje de arriba y ninguna campaña.

Preguntas frecuentes

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.

Formas de Script relacionadas

First order discount

A discount for shoppers with no order history, or with enough of it.

First time customer, cheapest item

A new-customer gate wrapped around a cheapest-item reward.

Customer tag discount

A discount only tagged customers ever saw.

Pega tu Script y mira cómo se reconstruye

La reconstrucción se compara con el dinero que cobraba tu Script antiguo antes de que puedas publicarla.

Usamos cookies esenciales para el funcionamiento de este sitio y, solo con tu permiso, cookies analíticas para entender el tráfico. Lee nuestra Política de cookies.