Magento2 Change the payment method title dynamically based on the text set from admin

I have created a test payment method using following reference.


I need to show the payment method title on checkout page based on a text box value set in admin. How can I achieve that? For e.g. as we can change the Flatrate & check/money order title from admin

1 Answer 1


update your system.xml as with below code and clear cache. you are able to set title in admin and it will dynamically changed on frontend too.

<?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="testpayment" translate="label" sortOrder="2" showInDefault="1" showInWebsite="1" showInStore="1">
                    <label>Test Payment</label>
                    <field id="active" translate="label comment" sortOrder="1" type="select" showInDefault="1" showInWebsite="1" showInStore="0">
                    <field id="title" translate="label" type="text" sortOrder="2" showInDefault="1" showInWebsite="1" showInStore="1">
                        <label>Payment Method Title</label>

hope this help :)

  • Hardluck not working...
    – Arjun
    Jul 6, 2021 at 6:31
  • it should work bro. don't know why not working for you Jul 6, 2021 at 7:01
  • I got my mistake. It worked. Thanks
    – Arjun
    Jul 6, 2021 at 7:10
  • happy to hear it worked :) Jul 6, 2021 at 7:21
  • Hello @Gohil, how can I display custom description that is added in admin under test payment method
    – Arjun
    Jul 6, 2021 at 10:23

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.