0

So basically I had to disable Cash on Delivery if some particular products were in the cart.

For this I created a custom attribute called Disable_COD and created a plugin which works around isAvailable() and returns false whenever the value for the attribute for any of the items in the cart is YES

This successfully removes the payment method.

But now I want to display text like:

Sorry! The Cash on Delivery payment method is unavailable because you have:

[item name(s)] in your cart. Please continue with online payment.

Instead of the place where the payment method was being displayed.

But I have no idea on how to proceed. All I know is:

Magento_Checkout/web/template/payment.html

This file is responsible for rendering the payment methods.

Any help would be appreciated!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.