Saltar al contenido
Ejemplos de Scripts

Migrating a script that held several campaigns

Merchants got one published script per type, so everything went in one file. A tool that reads the first rule and reports success has told you the file is handled when three quarters of it is not.

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

It ran several separate campaigns over the same cart, one after another.

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

# GENERATED BY THE SHOPIFY SCRIPT CREATOR APP
# Version 0.12.0

class Campaign
  def initialize(condition, *qualifiers)
    @condition = (condition.to_s + '?').to_sym
    @qualifiers = PostCartAmountQualifier ? [] : [] rescue qualifiers.compact
  end

  def qualifies?(cart)
    return true if @qualifiers.empty?
  end
end

CAMPAIGNS = [
  ConditionalDiscount.new(
    :all, nil, nil,
    ProductTagSelector.new(:does, :match, ["sale"]),
    PercentageDiscount.new(20, "20% off sale"),
    0
  ),
  ConditionalDiscount.new(
    :all, nil, nil,
    ProductVendorSelector.new(:does, ["Acme"]),
    PercentageDiscount.new(15, "15% off Acme"),
    0
  ),
  QuantityTierDiscount.new(
    :all, nil, nil,
    :line_quantity,
    [{tier: "5", discount: "10", message: "Buy 5+"}],
    0
  ),
  ConditionalDiscount.new(
    :all,
    CustomerTagQualifier.new(:does, :match, ["VIP"]),
    nil, nil,
    PercentageDiscount.new(25, "VIP 25% off"),
    0
  ),
].freeze

CAMPAIGNS.each do |campaign|
  campaign.run(Input.cart)
end

Output.cart = Input.cart
Qué pasa con este

We have not built this yet

This file holds several campaigns merged together, and the Script kept whichever gave the better price. We will not collapse them into one offer. Split them up and we can rebuild each one.

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

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: This file holds several campaigns merged together, and the Script kept whichever gave the better price. We will not collapse them into one offer. Split them up and we can rebuild each one.

Formas de Script relacionadas

Copied from a forum thread

A paste that lost its instance variables on the way through a forum post.

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.