Order Discount API with orderMinimumSubtotal condition not working as expected

Hi,

I’m trying to create an Order Discount Function with orderMinimumSubtotal condition but the result is different from the expected behavior.

I’m using this example as a reference. Here is the code of my function that runs when the coupon code “ctest” is applied to checkout

// @ts-check
import { DiscountApplicationStrategy, TargetType } from "../generated/api";

/**
 * @typedef {import("../generated/api").RunInput} RunInput
 * @typedef {import("../generated/api").FunctionRunResult} FunctionRunResult
 */

/**
 * @returns {FunctionRunResult}
 */
export function run() {
  return {
    discountApplicationStrategy: DiscountApplicationStrategy.First,
    discounts: [
      {
        // without conditions field everything works good
        conditions: [
          {
            orderMinimumSubtotal: {
              minimumAmount: 50,
              targetType: TargetType.OrderSubtotal,
              excludedVariantIds: [],
            },
          },
        ],
        targets: [
          {
            orderSubtotal: {
              excludedVariantIds: [],
            },
          },
        ],
        value: {
          fixedAmount: {
            amount: 5,
          },
        },
      },
    ],
  };
}

The expected behavior is the application of a fixed discount of 5 euros if the order subtotal is greater than or equal to 50 euros. The discount should be applied regardless of any product discounts. Here is the input of the discountCodeAppCreate mutation used to created the discount

{
  "codeAppDiscount": {
    "code": "ctest",
    "title": "ctest",
    "functionId": "...",
    "appliesOncePerCustomer": false,
    "combinesWith": {
      "orderDiscounts": true,
      "productDiscounts": true,
      "shippingDiscounts": true
    },
    "startsAt": "2021-02-02T17:09:21Z",
    "usageLimit": null
  }
}

however the discount is not applied if there is an automatic discount on the products (PRODUCT DISCOUT API (-€50.00))

removing the conditions field makes everything work properly.

Thanks for reporting this issue. We expect to have a fix out for this within the next day.

To be clear: after almost a month the bug has still not been fixed.

Pls is there any progress, I’m currently having the same problem

Apologies, it took much longer than anticipated. The bug fix for this shipped about a month ago now - please let me know if you continue to have issues.