⚠️   Shopify Scripts will no longer be supported as of June 30, 2026  ⚠️   read the Shopify article 

How to Create Discounts on Shopify with Functions

Table of Contents

  1. Introduction
  2. Clarifying Your Discounting Constraints
  3. Native Shopify Discount Methods
  4. The Power of Shopify Functions
  5. Implementing Tiered and Volume Discounts
  6. Gift with Purchase (GWP) Logic
  7. Script-to-Functions Migration Strategy
  8. Advanced Checkout Validation
  9. Promoting Sustainability and Reducing Waste
  10. Managing Italian Market Nuances
  11. Choosing the Right Nextools App (Decision Tree)
  12. Measuring the Impact of Your Discounts
  13. Nextools Shopify App Suite (Quick Links)
  14. Conclusion
  15. FAQ

Introduction

As Shopify moves aggressively toward Checkout Extensibility, the traditional methods of managing logic are shifting. For many high-volume merchants, the transition from Shopify Scripts to Shopify Functions represents a significant technical hurdle. The pressure to migrate isn’t just about deprecation; it’s about scalability, performance, and the ability to handle complex promotional logic without slowing down the checkout experience. At Nextools, we specialize in helping merchants navigate this transition by providing tools that bridge the gap between native Shopify limitations and advanced custom requirements.

Whether you are a Shopify Plus merchant looking to replicate complex Ruby scripts or a developer building a bespoke promotional engine, understanding how to create discounts on Shopify effectively is critical. Managing discount conflicts, ensuring compatibility across different Markets, and maintaining performance under heavy load require more than just “setting a code.” It requires a structured, engineering-led approach to promotional architecture.

This guide is designed for Shopify Plus merchants, specialized agencies, and technical leads. We will explore the entire spectrum of Shopify discounting—from native admin settings to the advanced Discount API—and show you how to leverage the Nextools Shopify App Suite to implement future-proof solutions. Following the Nextools Playbook, we will clarify your goals and constraints, confirm platform capabilities, choose the simplest durable approach (Functions-first), implement safely in staging, and measure the long-term impact on your Average Order Value (AOV).

Clarifying Your Discounting Constraints

Before implementing any discount strategy, you must define the technical and business boundaries of your store. Shopify’s discounting logic is not a monolith; it is a layered system where different rules apply based on your plan and checkout version.

Shopify Plan and Checkout Version

The most significant constraint is your Shopify plan. While basic discount codes are available to everyone, advanced logic—such as cross-market exclusions or complex shipping-and-discount interactions—often requires Shopify Plus. If you are still using the checkout.liquid architecture, your ability to use Shopify Functions is limited. Transitioning to Checkout Extensibility is the prerequisite for modern, performant discounting.

Markets and Currency

If you sell internationally via Shopify Markets, your discounts must account for multi-currency conversion. A fixed-amount discount of $10 might not translate perfectly to €10 if you haven’t configured your currency rounding rules correctly. Furthermore, certain discount types may be restricted in specific regions due to local tax laws or shipping regulations.

The Discount Stack

Shopify has strict rules about how discounts “stack.” You must decide if a product-level discount can be combined with an order-level discount. Historically, “stacking” was a major pain point, often leading to unintended margin erosion. Modern Shopify settings allow for explicit “Combination” rules, but these must be mapped out before execution to avoid logic loops or merchant-side losses.

Native Shopify Discount Methods

To understand how to create discounts on Shopify beyond the basics, we must first master the native tools provided in the Shopify Admin. These form the foundation upon which more complex logic is built.

Amount Off Products and Orders

The most common discount type is a fixed amount or percentage off specific items or the entire order.

  • Fixed Amount: Reduces the subtotal by a specific dollar value. Note that Shopify applies this proportionally across all items in the cart. If a $50 discount is applied to a $100 cart with two items, the discount is split based on the item value.
  • Percentage: Reduces the price by a set percentage. This is generally safer for margins as it scales with the cart size.

Buy X Get Y (BOGO)

BOGO offers are powerful for clearing inventory or increasing item count per order. Shopify allows you to set “Customer Buys” requirements (quantity or amount) and “Customer Gets” rewards.

Technical Note: In native Shopify BOGO, the “Get” item is not automatically added to the cart by the platform; the customer or a theme-side script must add the item first for the discount to trigger at checkout.

Free Shipping Discounts

These can be restricted by country or minimum purchase amount. However, they often conflict with other discount codes unless combinations are enabled. At Nextools, we often see merchants struggle with shipping rates that should be hidden when a specific discount is applied. For these scenarios, tools like HideShip allow you to manage the visibility of shipping methods based on the presence of a discount, ensuring a clean checkout experience.

The Power of Shopify Functions

When native settings aren’t enough, we turn to Shopify Functions. Functions are the successor to Shopify Scripts. They allow developers to write custom logic that runs on Shopify’s infrastructure, ensuring lightning-fast execution even during peak traffic like Black Friday.

Why Choose Functions Over Scripts?

Shopify Scripts used the Ruby-based “Script Creator,” which was limited to Shopify Plus and executed in a way that could occasionally impact checkout latency. Functions, however, are compiled to WebAssembly (Wasm) and run in under 10ms. They are more reliable and are becoming the standard for all complex checkout logic.

For merchants who don’t want to build a custom app from scratch, our app SupaEasy acts as a Shopify Functions generator. It allows you to create payment, delivery, and discount logic without writing raw code, and it even includes an AI-assisted generator for particularly unique use cases.

Discount Classes in Functions

When working with the Discount API via Functions, you must understand three primary “targets”:

  1. Product Discounts: Targets specific line items.
  2. Order Discounts: Targets the entire cart subtotal.
  3. Shipping Discounts: Targets the delivery cost.

By using SupaEasy, you can define these targets through a visual interface. For example, you can create a rule that says: “If the customer is from the ‘VIP’ segment and has more than 5 items in the cart, apply a 20% discount on the most expensive item and offer free shipping.”

Implementing Tiered and Volume Discounts

Volume-based pricing is a staple of B2B and high-growth DTC brands. Creating these on Shopify requires logic that can dynamically calculate totals as quantities change.

Manual Tiering vs. Automated Logic

You could manually create multiple discount codes (e.g., VOLUME10, VOLUME20), but this creates a poor user experience. Instead, automated tiered discounts are preferred. Using Multiscount, you can set up tiered product or order discounts that apply instantly.

For instance:

  • Tier 1: Buy 2 items, get 5% off.
  • Tier 2: Buy 5 items, get 10% off.
  • Tier 3: Buy 10 items, get 20% off.

This app, part of the Nextools Shopify App Suite, handles the “stacking” logic for you, ensuring that the highest applicable tier is the only one that applies, protecting your margins while incentivizing higher spend.

POS Integration

If you have a physical presence, your discount logic must work at the Point of Sale. Native Shopify automatic discounts work on POS Pro locations. When using Multiscount, you can specifically toggle whether a discount should run on your online store, POS, or both, providing a true omnichannel promotional strategy.

Gift with Purchase (GWP) Logic

A major limitation of native Shopify discounting is the inability to automatically add a free gift to the cart. As mentioned earlier, native BOGO requires the customer to add the “Get” item themselves. This results in high “missed gift” rates and customer support inquiries.

Automating the “Gift” Experience

To solve this, we developed AutoCart. This app allows you to create automation rules that add or remove items based on cart conditions.

Scenario: You want to offer a free tote bag for every order over $150.

  1. The Native Way: Customer spends $150, enters code “FREEGIFT,” but nothing happens because the tote isn’t in the cart.
  2. The AutoCart Way: The moment the cart hits $150.01, AutoCart injects the tote bag into the cart and applies a 100% discount to that specific line item via Shopify Functions.

This “Simple Durable Approach” ensures the merchant’s intent is met without forcing the customer to jump through hoops, significantly improving the conversion rate of the promotion.

Script-to-Functions Migration Strategy

For established Shopify Plus stores, the move away from Shopify Scripts is the biggest project on the horizon. Scripts often handled complex logic like “Exclude discounted items from the ‘Free Shipping’ threshold” or “Apply a specific discount only if the payment method is Credit Card.”

Mapping Logic

The first step in migration is auditing your existing .rb files. You need to map each “If/Then” statement to a corresponding Shopify Function.

  • Payment Logic: Move to the Payment Customization API (supported by HidePay).
  • Shipping Logic: Move to the Delivery Customization API (supported by HideShip).
  • Discount Logic: Move to the Discount API (supported by SupaEasy).

Safe Implementation

Never deploy a migrated Function directly to your live store. At Nextools, we recommend a strict QA process:

  1. Development Store: Use the Free Dev plans for SupaEasy or Cart Block to build and test the logic.
  2. Edge Case Testing: What happens if a customer uses a gift card? What if they are in a different Market? What if they try to use an “Abandoned Cart” recovery code on top of the Function?
  3. Rollout: Deploy during low-traffic periods and monitor the “Checkout Completion” metrics in Shopify Analytics.

Advanced Checkout Validation

Sometimes, the best discount strategy is knowing when not to allow one. Fraud prevention and order validation are key to maintaining a healthy bottom line.

Blocking Discount Abuse

Bots and “coupon hunters” often exploit combination rules to stack discounts in ways you didn’t intend. While Shopify’s native “Combinations” settings help, you may need harder validation. Cart Block allows you to set specific conditions under which a checkout is blocked entirely.

For example, you could block the checkout if:

  • A specific high-value discount is used with a risky payment method.
  • The shipping address doesn’t match the required format for a “Local Only” discount.
  • A customer tries to use a “New Customer” discount while having a historical order count > 0.

By validating the cart before the payment is processed, you reduce chargebacks and ensure that your discounts are going to the intended audience.

Promoting Sustainability and Reducing Waste

A unique way to create discounts on Shopify is through the lens of sustainability. Merchants often have “imperfect” stock—returns, expiring goods, or refurbished items—that shouldn’t be sold at full price but shouldn’t be thrown away either.

Using NoWaste, you can create specific product batches for these items and apply automated discounts. This allows you to maintain a high price point for “Grade A” stock while moving “Grade B” stock through a dedicated, discounted channel on your site. This not only increases revenue but also aligns with modern consumer values regarding waste reduction.

Managing Italian Market Nuances

For our Italian merchants or those expanding into Italy, discounting and invoicing are inextricably linked. When you apply a discount on a Shopify order, the generated invoice must reflect the net price and the correct VAT application.

Fatturify ensures that when a discount is applied, the sync with “Fatture in Cloud” remains accurate. It handles the automatic generation of invoices and sends them to the SDI (Sistema di Interscambio), ensuring your discounting strategy doesn’t create an accounting nightmare. Furthermore, if you are shipping these discounted items via Poste Italiane, PosteTrack provides the necessary tracking updates to keep your customers informed, which is vital for maintaining trust when running high-volume sales.

Choosing the Right Nextools App (Decision Tree)

With so many options in the Nextools Shopify App Suite, choosing the right starting point is essential for efficiency.

  • “I need to create a discount that Shopify doesn’t support natively (e.g., based on payment method or customer tags).”
    • Solution: SupaEasy. Use the Functions Wizard to build exactly what you need.
  • “I want to run tiered pricing (Buy more, save more) across my whole catalog.”
  • “I want to automatically add a free product to the cart when a spend threshold is hit.”
  • “I need to block specific discount codes from being used in certain countries.”

Measuring the Impact of Your Discounts

The final stage of the Nextools Playbook is measurement. A discount that increases sales but destroys your contribution margin is not a success.

Key Performance Indicators (KPIs)

  • Discount Usage Rate: Are customers actually finding and using your codes?
  • AOV Impact: Did the “Buy 3, Get 10% Off” rule actually increase the number of items per cart, or did it just lower the price for people who were already buying 3 items?
  • Checkout Abandonment: If you have too many complex discount rules, does it slow down the checkout or confuse the customer?
  • Support Volume: Are you getting tickets from customers who thought they were getting a discount but didn’t? This usually points to a logic conflict that needs to be resolved with a Functions-based tool like SupaEasy.

By iterating on these metrics, you can refine your promotional strategy from a “guess-and-check” method to a precision-engineered growth engine.

Nextools Shopify App Suite (Quick Links)

Explore our full range of tools designed to optimize your Shopify checkout and promotional logic:

Conclusion

Understanding how to create discounts on Shopify is no longer just about generating a code in the admin. In the era of Checkout Extensibility, it is about building a robust logical framework that prioritizes performance, margin protection, and customer experience.

By following the Nextools Playbook, you can move away from brittle, legacy solutions and toward a Functions-first architecture:

  1. Clarify: Define your market, currency, and stacking rules.
  2. Confirm: Recognize where native Shopify ends and where you need custom logic.
  3. Choose: Select the simplest, most durable tool—whether that’s Multiscount for tiers or SupaEasy for custom Functions.
  4. Implement: Use development stores and QA scenarios to ensure your logic is airtight.
  5. Measure: Track AOV and conversion to ensure your promotions are driving real value.

Ready to take your promotional strategy to the next level? Explore the Nextools Shopify App Suite and start building a better checkout today.

FAQ

Does creating custom discounts require Shopify Plus?

While basic discount codes and automatic discounts are available on all Shopify plans, creating advanced logic via Shopify Functions or migrating from Shopify Scripts requires Shopify Plus for certain APIs. However, many apps in the Nextools suite, such as Multiscount and HidePay, offer powerful functionality for all merchants, as listed on the Shopify App Store at time of writing.

How do I avoid “discount stacking” issues where customers use too many codes?

Shopify provides native “Combinations” settings (Product, Order, Shipping). To ensure strict control beyond these settings, you can use SupaEasy to write logic that explicitly checks for existing discounts before applying a new one, or use Cart Block to prevent a checkout if an invalid combination is detected.

Can I test my new discount logic without affecting live customers?

Yes. We strongly recommend using a Shopify Development Store or a Plus Sandbox store. All Nextools apps offer a Free Dev Plan for testing. This allows you to verify that your Functions-based discounts trigger correctly across different cart scenarios before deploying to production.

Is it difficult to migrate my existing Ruby Scripts to Shopify Functions?

Migrating requires mapping your Ruby logic to the Discount, Payment, or Delivery Customization APIs. While this can be complex if done manually, SupaEasy provides a “Scripts Migrator” and AI-assisted tools to simplify the process, making it accessible for merchants who do not have a dedicated developer on hand.

SupaEasy is a product built & designed by Nextools

Company

© [2024] website by Nextools. All Rights Reserved. PIVA: 16711981007