free
web stats

Fill the form & Get Installation Support

We don't monkey around your business.

GET IN TOUCH WITH US NOW





Enable COD payment method for some products using programming in Magento 2

If you want to Enable COD Payment Method for Particular Products, Follow below steps

You need to create an extension for this,

Here I have created extension : Magemonkeys_CodRestrict

1. Add new YES/NO product attribute i.e enable_cod_payment and set in Attribute Set which you are using for products

2. Create registration.php file in app/code/Magemonkeys/CodRestrict and add below code

3. Create module.xml file in app/code/Magemonkeys/CodRestrict/etc and add below code

3. Create module.xml file in app/code/Magemonkeys/CodRestrict/etc and add below code

4. Create events.xml file in app/code/Magemonkeys/CodRestrict/etc and add below code

5. Create CodAvailable.php file in app/code/Magemonkeys/CodRestrict/Observer and add below code

You can change payment method condition as per your need.