Zend certified PHP/Magento developer

Magento 2.4 Restrict Apply Coupon code if cart has item with 0 price

In Magento 2.4, I want to create a cart rule and that can not be applied if any product in the cart with 0 price.

For Example, I have created a coupon code that allows a 20% discount on the total of the cart, and it is working fine.

Now let’s assume in my cart I have 4 products and among them, 1 product is with 0 price.

But I want that coupon not to be applied and give an error like “Invalid Coupon code” if any product is in the cart with a price of 0.