Order Discount timing - Shopify Functions

Topic summary

Goal: apply an automatic order-level discount based on customer tags as soon as a shopper lands in checkout after email prefill via cart redirect.

Observed behavior: with multi-page checkout, the Order Discount function (using buyerIdentity → customer tags) only shows the discount at the Shipping step. A page refresh on the Information step also reveals the discount, suggesting timing/refresh issues. Switching to one-page checkout shows the discount immediately upon landing.

Suggestions discussed: consider adding a Checkout UI extension component on the customer info step to communicate discount status. No mechanism was identified to control the exact timing of when the order discount function applies within multi-page checkout.

Decision: client accepted one-page checkout, resolving the initial timing concern.

New issue: the discount function later stopped running entirely. It appears registered (IDs match in GraphiQL and the app’s extension page), but no runs/logs occur at the purchase.order-discount.run target. Checkout shows a 401 from a private_access_tokens request. Reinstalling/recreating the app did not help.

Status: unresolved; awaiting guidance on why the function no longer executes despite being registered.

Summarized with AI on January 13. AI used: gpt-5.

So client ended up being totally fine with 1-step checkout so that’s the route we’re going to continue down.

After that I had the app fully working, on checkout it tagged customers correctly, and then an Order Discount function would run to check customer tags and apply a discount if certain criteria was met.

I was getting function run logs in my partners panel extension page for the app until recently.

Now for the life of my I cannot get the function to run whatsoever.

Checking for the function in my development store using Shopify Graphiql I can see that Shopify is registering my function - the id lines up with what I’m seeing on the extension page of the app’s dashboard, but on checkout it doesn’t run, and I don’t get any “runs” inside my partners panel.

When I land on the checkout page I do see a call to https://{my-store}.myshopify.com/private_access_tokens?id=... which is returning a 401 error. Through another post on this forum I tried completely uninstalling my app, deleting it, and creating another one for testing with no luck at all.

Any help or ideas on why Shopify appears to be registering my function but it doesn’t run at the correct target (purchase.order-discount.run) would be greatly appreciated.