Discount allocator Function

Topic summary

Problem allocating order-level discounts to line items using the Discount Allocator Function (a Shopify Functions extension that distributes order discounts across line items). The reported behavior: with an order discount of 120 applied to two items priced 75 and 100, the input to the function only targets the first line item, not both. This persists even when adding another order-level discount, preventing accurate calculation of valid discount allocation.

Expectations: the merchant expects Shopify’s input/query to indicate which line items a given order discount should target, enabling correct allocation and limits per order.

Community feedback: another member suspects a bug in the allocator function’s logic and requests the function code to diagnose. The original poster says they cannot determine which discount applies to which product from current inputs and believes Shopify should return that mapping. The helper reiterates that they need to see the code and offers a screenshare.

Status: unresolved/ongoing. Next steps: share allocator function code or schedule a screenshare. Note: screenshots are referenced and central to the issue context.

Summarized with AI on December 28. AI used: gpt-5.

I try to use Discount Allocator function extension for limiting the number of discount apply to order.
But input query return so wrong

As image, i test an order discount with value 120, first line item worth 75đ and second worth 100đ, the input query should return target for both 2 line item.
Somehow, it alway target to only first line item even how much discount value bigger than first line item price. Even i try to add another order discount, it still target the first one. I cannot calculate value of valid discount with this data.

This is urgent!!

You’ll need to share the code of your allocator function. There might be some bug in the logic.

I have thought about that solution, but i cannot figủe out which discount can be applied to which product to provide an accurate allocator function. It should be returned by a query from Shopify

Sorry buddy. Can’t help without seeing exactly whats happening. If you are available we can schedule a screenshare.