Pular para o conteúdo
Exemplos 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.

Ainda sem suporte
O que o Script fazia

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

Teste na sua própria loja

Cole no Resgate de Scripts e veja o que ele reconstrói

  1. Copie o Ruby no botão ao lado de qualquer Script desta página.
  2. No admin da Shopify, abra o Stackable, depois Ferramentas e depois Resgate de Scripts.
  3. Cole lá, leia o que a ferramenta diz que vai criar e compare com as configurações desta página.

O Resgate de Scripts está no plano Pro. Nada é publicado até você informar quanto o Script antigo descontava e os dois valores baterem no centavo.

O Script

Ainda sem suporte
O 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
O que acontece com 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.

Essa falta é nossa, não da Shopify. A Shopify permite e nós não construímos, então não há nada para linkar aqui e nada para culpar na plataforma.

Chave do motivo: unsupported.customerTotalSpent

Não há carrinho para testar aqui, porque nada é criado. Colar isso produz a mensagem acima e nenhuma campanha.

Perguntas frequentes

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.

Formatos de Script relacionados

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.

Cole o seu Script e veja a reconstrução

A reconstrução é comparada com o valor que o seu Script antigo cobrava antes de você poder publicá-la.

Usamos cookies essenciais para operar este site e, apenas com sua permissão, cookies de análise para entender o tráfego. Leia nossa Política de Cookies.