2

I created a new payment method in Magento 2 using the instructions here

The payment method is created successfully. However, I want to add instructions under the payment method in the red box in attached image.

enter image description here

I checked this link, but It didn't help.

I am using magento 2.1.5 EE

Any help is appreciated.

3

You can add custom html in payment html file at

app/code/Test/Testpayment/view/frontend/web/template/payment/mypayment.html

You can add your custom html before <div class="actions-toolbar">

<div class="payment-method" data-bind="css: {'_active': (getCode() == isChecked())}">
    <div class="payment-method-title field choice">
        <input type="radio"
               name="payment[method]"
               class="radio"
               data-bind="attr: {'id': getCode()}, value: getCode(), checked: isChecked, click: selectPaymentMethod, visible: isRadioButtonVisible()"/>
        <label data-bind="attr: {'for': getCode()}" class="label"><span data-bind="text: getTitle()"></span></label>
    </div>
    <div>ADD YOUR HTML HERE</div>
    <div class="payment-method-content">
        <div class="actions-toolbar">
            <div class="primary">
                <button class="action primary checkout"
                        type="submit"
                        data-bind="
                        click: placeOrder,
                        attr: {title: $t('Place Order')},
                        css: {disabled: !isPlaceOrderActionAllowed()},
                        enable: (getCode() == isChecked())
                        "
                        disabled>
                    <span data-bind="i18n: 'Place Order'"></span>
                </button>
            </div>
        </div>
    </div>
</div>

Now remove static payment template file from pub/static/frontend/vendor/theme/en_US/Vendor_Module/template/payment

Flush cache and try....!

OUTPUT:

enter image description here

|improve this answer|||||
  • .....Its not working ..... after clear cache .....@Prince – Mahi M Mar 1 '18 at 10:05
  • I am overwriting the payment template but need access to customer data, any idea which Helper class is used to get section data for the payment template html page since I don't see any information in layout XML files? – cnu Apr 5 '19 at 23:42

Your Answer

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

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