Saltar al contenido
Ejemplos de Scripts

Migrating a reject discount code script

This one changed under everyone’s feet. Rejecting a typed code was impossible for a discount function until December 2025 and is possible now, with one restriction that decides whether your file can be rebuilt.

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

It rejected the discount code the shopper had entered and showed them a reason.

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

REJECTION_MESSAGE = "Discount codes cannot be used during a sale"

unless Input.cart.discount_code.nil?
  Input.cart.discount_code.reject(message: REJECTION_MESSAGE)
end

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

We have not built this yet

Your Script turned away a discount code the shopper typed. Shopify allows that only from an automatic discount, so we can rebuild it if this campaign runs automatically rather than on its own code.

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

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 turned away a discount code the shopper typed. Shopify allows that only from an automatic discount, so we can rebuild it if this campaign runs automatically rather than on its own code.

Formas de Script relacionadas

Discount code driven

Script logic that only ran when the shopper had typed a particular code.

Discount code pattern

A whole family of codes driving one rule through a prefix match.

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.