Web Analytics

Fill the form & Get Installation Support

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.

Fill the below form if you have any Magento programming need.





    Recent Articles

    Author Info

    Author Image

    Magento Certified Developer

    Hire V. Brahmbhatt

    Get a Free Quote





      /* second popup */

      Connect With Us