I want to ask how to customize and add extra cost to customer basket for select payment "cash on delivery:".

I created file in vendor/magento-offline-payments/adminhtml/system.xml with following content

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd">
        <section id="payment">
            <group id="cashondelivery">
                <field id="extra_fee" translate="label" type="text" sortOrder="65" showInDefault="1" showInWebsite="1" showInStore="0">
                    <label>Extra Fee Charge</label>
                    <validate>validate-number validate-zero-or-greater</validate>

In this field I add extra amount:https://prnt.sc/rqy3dr

How can I add this amount to the basket if the customer chooses this option when ordering?


1 Answer 1


Please check this small extension which is work for you.

Hope it will help.

Happy Coding.

  • That's great. I was looking for that!
    – Sylvester
    Apr 2, 2020 at 21:32
  • @Sylvester Happy Coding :) Apr 3, 2020 at 4:06

Your Answer

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

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