Saltar al contenido
Ejemplos de Scripts

Migrating a free shipping for certain products script

There is a single word in this template that changes the offer completely. After discounting the first paid rate it breaks out of the loop, so every other rate stays full price. A reader who skims the loop makes them all free.

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

It made the first paid delivery rate free when the cart contained a product carrying 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

Aún no admitido
El Ruby original

FREE_TAG = 'freeship'

if Input.cart.shipping_address.country_code == 'US' && Input.cart.line_items.any? { |item| item.variant.product.tags.include? FREE_TAG }
  Input.shipping_rates.each do |shipping_rate|
    next if shipping_rate.price == Money.zero
    shipping_rate.apply_discount(shipping_rate.price, message: "Free Shipping!")
    break
  end
end

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

We have not built this yet

Your Script decided free shipping from what was in the cart. Our free shipping is decided by what the cart is worth.

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

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 decided free shipping from what was in the cart. Our free shipping is decided by what the cart is worth.

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.