Automatic Discounts Not Applying Immediately to GraphQL-Created Products at Checkout – Seeking Developer Solutions

Topic summary

A developer is experiencing a critical issue where automatic discounts fail to apply immediately to products created dynamically via Shopify’s GraphQL Admin API (productCreate mutation).

The Problem:

  • Custom products (e.g., personalized engravings) are created on-the-fly and added to cart successfully
  • At checkout, automatic discounts don’t apply initially—requiring 2-3 page refreshes or ~2 minutes to activate
  • Customers see incorrect (higher) prices, causing cart abandonment and lost conversions

What’s Been Tried:

  • Adding 2-minute artificial delays post-creation (breaks UX)
  • Triggering re-indexing via minor product edits (inconsistent)
  • Switching to manual discount codes with auto-apply (works instantly but requires generating unique codes per session, complicating the “always-on” 20% discount flow)

Support Response:
Shopify support cited “expected indexing delays” of up to 2 minutes for discount eligibility checks, even for single products. Multiple tickets escalated (61704009, 61704612, 61705284).

Seeking Solutions:

  • Methods to force immediate indexing after productCreate
  • API hooks or webhooks to notify the discount engine
  • Client-side discount application via Storefront API extensions
  • Workarounds using Draft Orders or alternative APIs
  • Whether Shopify’s dev team has addressed similar real-time product creation indexing delays

Status: Unresolved—looking for developer or Shopify engineer input on viable technical solutions.

Summarized with AI on November 17. AI used: claude-sonnet-4-5-20250929.

Hi Shopify Developer Community,

I’m a developer working on a custom integration for our store, and I’m running into a frustrating issue with automatic discounts not applying right away to products created dynamically via the GraphQL Admin API. This is causing checkout delays that are leading to cart abandonment and lost sales—especially since we’re investing heavily in marketing to drive traffic. I’ve already escalated this through multiple support chats (tickets: 61704009, 61704612, 61705284), but the responses pointed to expected “indexing delays” (up to 2 minutes even for single products) and suggested workarounds like switching to manual discount codes or adding artificial delays in our workflow. These aren’t viable for our real-time customization flow, as they break the user experience.

I’d love insights from fellow developers or Shopify engineers on a proper fix—perhaps something around forcing immediate indexing, API hooks, or alternative discount application methods that don’t rely on post-creation syncing.

Issue Description

  • What happens: We use the GraphQL Admin API (productCreate mutation) to generate a single, customized product variant on-the-fly (e.g., based on user inputs like engraving). The product adds to the cart successfully via the Storefront API. However, at checkout:
    • The automatic discount (set up in the admin under Discounts > Automatic discounts) doesn’t apply initially.
    • It takes 2-3 page refreshes or about 2 minutes for the discount to “kick in” and reflect the correct pricing.
  • Impact: Customers see inflated prices at first, leading to confusion and drop-offs. This is killing conversions on our personalized product pages.

Steps to Reproduce

  1. Create a product via GraphQL Admin API (example mutation below—sanitized for our store):

    mutation productCreate($input: ProductInput!) {
      productCreate(input: $input) {
        product {
          id
          title
          variants(first: 10) {
            edges {
              node {
                id
                price
              }
            }
          }
        }
        userErrors {
          field
          message
        }
      }
    }
    
    # Variables example
    {
      "input": {
        "title": "Custom Engraved Ring - User Order",
        "productType": "Personalized Jewelry",
        "vendor": "ABCD",
        "variants": [
          {
            "price": "299.00",
            "sku": "CUSTOM-{{order_id}}"
          }
        ],
        "status": "ACTIVE"
      }
    }
    
  2. Add the new product to cart using Storefront API (cartLinesAdd).

  3. Proceed to checkout (/checkouts/{token}).

  4. Observe: Subtotal shows full price—no discount applied. Refresh 2-3 times → discount applies.

What We’ve Tried

  • Support Recommendations:
    • Add a 2-minute delay in our app workflow before redirecting to checkout (not feasible for UX).
    • Trigger re-indexing by making a minor edit (e.g., add/remove space in title) post-creation—adds complexity and still inconsistent.
    • Switch to manual discount codes with auto-apply: This works instantly but requires generating/applying unique codes per session, which complicates our flow and doesn’t match our “always-on” 20% off personalized items discount.
  • Our Tests:
    • Confirmed the discount targets the correct product type (“Personalized Jewelry”) and has no exclusions.
    • Tested with single products only—no bulk ops.
    • Verified API responses: Product is created with status: ACTIVE, but eligibility checks at checkout seem delayed.
    • Screenshot of discount settings: [Attached: discount-settings.png] (20% off on specific product types, active, no min/max purchase reqs).
    • No errors in API responses or browser console.

Questions for the Community

  1. Is there a way to force immediate indexing after productCreate? Maybe a separate mutation or webhook to notify the discount engine?
  2. Can automatic discounts be applied client-side via Storefront API extensions, bypassing indexing?
  3. Any known workarounds using Draft Orders or other APIs that apply discounts synchronously?
  4. Has Shopify’s dev team addressed similar indexing delays for real-time product creation? (Support mentioned a feature request was logged, but no ETA.)

We’re on the latest GraphQL API version (2024-10) and using a custom app with necessary scopes (write_products, read_discounts, etc.). Happy to share more code snippets, API logs, or hop on a quick call if needed.

Thanks in advance for any guidance, this one’s a real blocker, and your expertise would mean a ton for keeping our customers happy!

Best,
Ayush Varma
Shopify Developer,