Saltar al contenido
Ejemplos de Scripts

Migrating a free shipping for tagged customers script

Shopify shipped this in its own repo. The gate lowercased both sides of the tag comparison; Shopify matches tags exactly, so a tag typed VIP in one place and vip in the other is a silent no-op.

Reconstruido
Qué hacía el Script

It made delivery free for shoppers whose customer record carried a particular tag.

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

Reconstruido
El Ruby original

VIP_TAG = "VIP"

if !Input.cart.customer.nil? && Input.cart.customer.tags.include?(VIP_TAG)
  Input.shipping_rates.each do |shipping_rate|
    shipping_rate.apply_discount(shipping_rate.price, message: "Free shipping for VIP")
  end
end

Output.shipping_rates = Input.shipping_rates
En qué se convierte

Reconocido como Shipping discount y reconstruido como una oferta de tipo free_shipping. Estas son las claves de configuración reales con las que se guarda la oferta, así que puedes comparar tu propia reconstrucción campo por campo.

Cada ajuste, detallado
AjusteValorClave de configuración
Offer typefree_shippingtype
Countingper_cartcounting
Recurrenceoncerecurrence
Tier 1min spend $0.00 -> 100% offtiers[0]
Target scopealltarget.scope
Customer scopetagscustomerTarget.scope
Customer tagsVIPcustomerTarget.ids
MethodautomaticdiscountMethod
Allocationstandardstacking.allocation
Combines with other discountsnostacking
Se te pedirá que confirmes
  • This script only applied to tagged customers. Set customer eligibility in the builder before publishing.
  • Confirm which products this applies to. We could not read product targeting from the script.
Se te avisará
  • This discounts every shipping rate at checkout, not one named rate.
  • Shopify matches customer tags exactly, including capital letters, while your Script lowercased them. Check the spelling of the tag before you publish.
El carrito que lo demuestra

Creado en nuestra tienda de demostración pública, Meridian Goods, para que cada precio de aquí se pueda reproducir en lugar de darlo por bueno. El descuento de abajo es lo que calcula para este carrito exacto el mismo motor que se ejecuta en el pago.

El carrito que activa esta oferta, y lo que cuesta
ArtículoCant.Precio unit.
Braided USB-C Cable1$14.00
Subtotal$14.00
Envío, normalmente $6.90$0.00
Total$14.00

Sesión iniciada como cliente con la etiqueta VIP.

La cifra con la que la herramienta te compara

This rebuild only changes shipping. We price shipping against a sample rate rather than the rate your shopper saw, so there is no figure here we could honestly compare. Publishing records that the amount was not checked.

El carrito que no debe producir nada
  • take the same cart, but sign in as the customer with no tags
El carrito que no debe activar esta oferta
ArtículoCant.Precio unit.
Braided USB-C Cable1$14.00
Subtotal$14.00
Total$14.00

Sin sesión iniciada, o con sesión de un cliente sin etiquetas.

Preguntas frecuentes

Will Stackable rebuild this script?
Yes. Every spelling on this page is rebuilt today as a free_shipping offer, and the cart above is the one that proves it.
What cart proves it works?
1 x Braided USB-C Cable at $14.00. The engine takes $6.90 off, and checkout charges $14.00 plus $0.00 delivery.
What will I have to check before publishing?
This script only applied to tagged customers. Set customer eligibility in the builder before publishing. Confirm which products this applies to. We could not read product targeting from the script. This discounts every shipping rate at checkout, not one named rate. Shopify matches customer tags exactly, including capital letters, while your Script lowercased them. Check the spelling of the tag before you publish.

Formas de Script relacionadas

Percentage off shipping

A share taken off every delivery rate at checkout.

Amount off shipping

A flat sum off the delivery charge, floored at free.

Flat rate shipping

Every delivery rate rewritten to one price rather than reduced by an amount.

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.