Executing two pieces of code in a sequence

I have two pieces of code in Express js. I want to execute them conditionally and I am not able to understand how to exactly do this. Code is:

//Check whether all of the Applied Discounts are combinable with Product Discount
cart.items.forEach(item => {
    if (item.discounts && typeof item.discounts !== "undefined") {
        item.discounts.forEach(discount => {
            if (discount.title && typeof discount.title !== "undefined") {
                get_details_for_automatic_discounts(discount.title, function (response) {
                    if (response.combinesWith && typeof response.combinesWith !== "undefined") {
                        const _combinesWith = response.combinesWith; // Pre applied Discount on cart page
                        if (discountClass === "PRODUCT") {
                            if (!_combinesWith.productDiscounts) {
                                console.log("False 1");
                                return callback({
                                    apply_coupon_code: false
                                });
                            }
                        }
                    } else {
                        console.log("True 0")
                        return callback({
                            apply_coupon_code: true
                        });
                    }
                });
            }
        });
    }
});

// Check if none of the inner callbacks were executed and then execute the final callback
console.log("Final callback executed");
return callback({ // This is the code I want to run only and only after the previous loop have completely been executed
    apply_coupon_code: true
});

Here the loop checks a condition and if for ANY ONE item in the cart, the condition is true, return callback as apply_coupon_code: false but ONLY if all the items have been checked thoroughly and the condition was not true for ANY SINGLE item in the array, return callback as apply_coupon_code: true, but the issue here is that the control transfers to this piece of code:

console.log("Final callback executed");
return callback({ // This is the code I want to run only and only after the previous loop have completely been executed
    apply_coupon_code: true
});

as soon as the loop starts and hence, the wrong value is returned in the callback and also, multiple return callbacks are called because the loop was still running in the background.
I have tried this:

var callbackExecuted = false;
async function check_for_cart_items () {
    await cart.items.forEach(item => {
        if (item.discounts && typeof item.discounts !== "undefined") {
            item.discounts.forEach(discount => {
                if (discount.title && typeof discount.title !== "undefined") {
                    get_details_for_automatic_discounts(discount.title, function (response) {
                        if (response.combinesWith && typeof response.combinesWith !== "undefined") {
                            const _combinesWith = response.combinesWith; // Pre applied Discount on cart page
                            const _discountClass = response.discountClass; // Pre applied Discount Class on cart page
                            if (discountClass === "PRODUCT") {
                                if (!_combinesWith.productDiscounts) {
                                    console.log("False 1");
                                    callbackExecuted = true;
                                    return callback({
                                        apply_coupon_code: false
                                    });
                                }
                            }
                        } else {
                            console.log("True 0")
                            callbackExecuted = true;
                            return callback({
                                apply_coupon_code: true
                            });
                        }
                    });
                }
            });
        }
    });  
}

check_for_cart_items().then(() => {
    // Check if none of the inner callbacks were executed and then execute the final callback
    if (!callbackExecuted) {
        console.log("Final callback executed");
        return callback({
            apply_coupon_code: true
        });
    }
})

but it is still creating issue for me. I am already using callback function. so i am inside a callback function. I cannot provide more of the code due to security reasons. You may ask questions if needed. Using VS Code as Code Editor. OS is Windows 11.