Strange problem with creating an order using createOrder()

There are products on my website that are out of stock, but the “Pre-order” function is enabled.

When I try to create an order with such a product, I get the error “Insufficient inventory for order”.
But what is most surprising is that despite this error, the order is created! What can I do to prevent this error from occurring?

I am using the function from the documentation:

import { orders } from "wix-ecom-backend";
import { webMethod, Permissions } from "wix-web-module";
import { elevate } from "wix-auth";

const elevatedCreateOrder = elevate(orders.createOrder);

export const createOrder = webMethod(
    Permissions.Anyone,
    async (orderData) => {
        try {
            const createdOrder = await elevatedCreateOrder(orderData);
            console.log("Замовлення створено:", createdOrder);
            return createdOrder;
        } catch (error) {
            console.error("Помилка при створенні замовлення з підвищеними правами:", error);
            console.log("Деталі помилки:", error?.details?.applicationError);
            throw new Error("Не вдалося створити замовлення");
        }
    }
);

Thank you for your help! I’m ready to thank the person who will help me solve this.