Migrating a line item property script
Personalisation, gift wrap and landing-page attribution all attach data to a single cart line rather than to the cart. Cart attributes and line properties look alike in a merchant’s description and are different fields.
Aún no admitidoIt read a custom property attached to a single cart line and branched on it.
Pégalo en Rescate de scripts y mira qué reconstruye
- Copia el Ruby con el botón que hay junto a cualquier Script de esta página.
- En tu panel de Shopify, abre Stackable, luego Herramientas y luego Rescate de scripts.
- 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 admitidoDISCOUNT_PERCENTAGE = 10
Input.cart.line_items.each do |line_item|
next unless line_item.properties.has_key?("_ref")
next unless line_item.properties["_ref"] == "landing-page-a"
line_item.change_line_price(
line_item.line_price * (1.0 - (DISCOUNT_PERCENTAGE / 100.0)),
message: "Landing page offer"
)
end
Output.cart = Input.cartWe have not built this yet
Your Script read a property on one line, such as an engraving or a delivery date. We only read properties on the whole cart 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.lineItemProperty
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 read a property on one line, such as an engraving or a delivery date. We only read properties on the whole cart today.
Formas de Script relacionadas
A discount limited to products carrying one tag, vendor or type.
Already-marked-down products protected from a second discount.
Gift cards left out of a discount that would otherwise have hit them.
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.