1

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.

1 Answer 1

1

Please look into this solution.

Override the controller CouponPost.php, class Magento\Checkout\Controller\Cart\CouponPost

Path : vendor/magento/module-checkout/Controller/Cart/CouponPost.php

In this controller get items from cart and check zero price product.

If the zero price product present then write your logic.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.