The Client Challenge: Loyal Customers Getting Shortchanged

Running a successful Shopify store often means balancing two powerful but conflicting goals: attracting new customers with eye-catching sitewide sales and rewarding loyal, high-value customers with exclusive VIP or returning-customer discounts.

One of our clients — a fashion and lifestyle e-commerce brand — faced this exact dilemma.

They offered live discounts for returning customers and VIP members, ranging from 10% to 25% off. These perks were designed to build long-term loyalty and increase customer lifetime value. At the same time, they frequently ran broad 15% or 20% sitewide sales to drive traffic and clear inventory.

Their existing setup relied on a “Not on Sale” collection. Products were tagged and included in this collection so that VIP discount codes could be restricted from applying to items already on promotion. When a sitewide sale launched, they simply removed the tag from affected products. This prevented discount codes from stacking in unwanted ways.

However, a serious problem emerged:

When a 15% sitewide automatic discount was active, a 25% VIP code would not apply at all — or would calculate on the already-reduced sale price instead of the original retail price. Loyal customers who expected a meaningful reward ended up with a smaller discount than new bargain hunters. In some cases, VIPs actually paid more (relatively) than first-time buyers.

The client’s team heard complaints: “Why am I getting less benefit even though I’m a regular customer?” This hurt retention and risked damaging brand perception among their most valuable audience.

They needed a smarter solution: VIP discounts should always calculate from the true retail price (Compare at Price or original value), not the temporary sale price, no matter what other promotions were running.

Understanding the Shopify Limitation

Shopify’s native discount system applies percentages and fixed amounts to the current variant.price — the price shown at checkout after any automatic discounts or manual price changes. The Compare at Price field is primarily for display purposes (strikethrough pricing on product pages) and does not influence how discounts are calculated.

This design works well for simple promotions but breaks down when merchants want to protect loyalty pricing during overlapping campaigns. The client’s collection-based exclusion helped control eligibility but couldn’t change the base price used for calculation.

They explored apps and basic customer segments, but none fully delivered the precision needed: true “discount on original retail” logic combined with intelligent stacking (e.g., giving the customer the better of the two offers without negative margins).

Our Solution: A Custom Shopify Discount Function

As programmers, we recommended and built a custom Discount Function using Shopify’s powerful Functions API (part of Checkout Extensibility). This approach provides full control over discount logic at the cart and checkout level, far beyond what native codes or most apps allow.

Here’s how we structured the solution:

  1. Store the True Original Price We created a variant metafield (e.g., pricing.original_retail_price) to hold the undiscounted retail value. This acts as a reliable reference even if Compare at Price changes or isn’t set. A simple bulk update script populated this field across the catalog initially, and product creation/editing workflows were updated to maintain it.

  2. Identify Eligible Customers We used Shopify Customer Segments and tags for “VIP” and “Returning” (automatically applied via Shopify Flow based on order count, total spend, or recency). This made targeting dynamic and low-maintenance.

  3. Custom Discount Logic in Rust (via Shopify Function) The core of the solution is a Product Discount Function that:

    • Checks if the customer belongs to a VIP or returning segment.
    • For qualifying line items, calculates the discount from the original_retail_price metafield (falling back to compareAtPrice if needed).
    • Determines the final price by comparing:
      • The sitewide sale price (if active)
      • The VIP discount applied to the original price
    • Applies the better deal for the customer while protecting the merchant’s margin rules (e.g., never going below a predefined floor price).
    • Prevents unwanted double-dipping by intelligently combining offers rather than letting them stack naively.

    Example simplified logic (conceptual):

    • Original retail: $100
    • Current sale price (after 15% sitewide): $85
    • VIP 25% off original: $75 → Customer pays $75 (VIP wins)

    If VIP discount was only 10% off original ($90), the customer gets the better $85 sale price.

  4. Checkout Experience Enhancements We paired the Function with a lightweight Checkout UI Extension to display clear messaging, such as: “As a VIP member, you’re receiving 25% off the original retail price — saving you an extra $XX today.”

    This transparency builds trust and reinforces the value of loyalty status.

  5. Fallback and Compatibility The solution works alongside existing automatic discounts and collection-based rules. We kept the “Not on Sale” tagging as a secondary safety net while the Function handled the advanced pricing logic.

Implementation Process

  • Discovery & Planning: We mapped all current promotion rules, edge cases (multi-currency, variants, taxes), and margin requirements.
  • Development: Built and tested the Discount Function in a development store using Shopify CLI. We iterated on stacking behavior to ensure VIPs were never disadvantaged.
  • Testing: Rigorous scenarios including sitewide + VIP, sale items only, full-price items, and mixed carts.
  • Deployment: Rolled out with minimal downtime. Updated theme Liquid slightly for better price display consistency on product and collection pages.
  • Monitoring: Set up basic logging and analytics to track discount uptake and customer feedback post-launch.

The entire custom development took about 2–3 weeks, depending on catalog size and testing depth. For stores not ready for full custom code, we also evaluated hybrid options using advanced discount apps that offer “calculate from compare at price” settings, but the Function provided the cleanest, most scalable result.

Results and Benefits

After implementation, the client reported:

  • Higher VIP retention — Loyal customers now clearly see and feel the value of their status, even during big sales.
  • Improved satisfaction — No more complaints about “losing” their discount.
  • Better merchandising flexibility — The team can run aggressive sitewide promotions without worrying about cannibalizing loyalty rewards.
  • Cleaner operations — Reduced manual tag management and fewer conflicting discount codes.
  • Protected margins — Custom logic ensures discounts stay within acceptable limits.

Most importantly, the brand strengthened its relationship with its best customers — the ones who drive the majority of long-term revenue.

Key Takeaways for Shopify Merchants

This case highlights a common but under-addressed challenge in e-commerce pricing strategy. When loyalty programs and promotional sales collide, native tools often fall short.

Modern solutions like Shopify Discount Functions give developers the power to implement sophisticated rules such as:

  • Discounts calculated from original retail price or metafields
  • Customer-segment-specific pricing
  • Intelligent offer prioritization (max benefit vs. strict stacking)

Whether you’re on Shopify Plus or a standard plan, Functions open the door to these advanced capabilities without relying solely on apps or workarounds.

If you’re struggling with overlapping discounts, VIP pricing, or want loyalty rewards that actually feel rewarding, a custom Discount Function (or a well-chosen app with similar logic) can transform the experience.

Ready to reward your best customers properly? Feel free to reach out — we help Shopify brands design and build precise pricing and loyalty systems that scale.


0 Comments

Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *