0

how to show custom configure message in cod payment method in magento2..

already refer these link.... How to display instructions for custom payment method

Magento 2: add html in custom Payment method

How to do this....Thanks

1 Answer 1

0

Try to add this in your custom module in path :

app/code/Custom/PaymentModule/view/frontend/web/template/payment/templatefile.php

<p class="aramex-cod-charge" style="width: 31%;                                             background: #D9EDF7;padding: 5px; border: 1px solid #879ca7;">
  <span data-bind="i18n: 'COD Charge: '"></span>
  <span data-bind="text: getCodCharge()"></span>
</p>

You can bind your text from translation file or custom it and you can make an config for your charge value in the backend to be more dynamically or put static value directlty.

Full Code for this file like:

<div class="payment-method" data-bind="css: {'_active': (getCode() == isChecked())}, visible: isAvailable()">
    <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 class="payment-method-content">
        <!-- ko foreach: getRegion('messages') -->
        <!-- ko template: getTemplate() -->
        <!-- /ko -->
        <!--/ko-->
        <div class="payment-method-billing-address">
            <!-- ko foreach: $parent.getRegion(getBillingAddressFormName()) -->
            <!-- ko template: getTemplate() -->
            <!-- /ko -->
            <!--/ko-->
        </div>
        <p data-bind="html: getInstructions()"></p>
        <p class="aramex-cod-charge" style="width: 31%;
                                            background: #D9EDF7;
                                            padding: 5px;
                                            border: 1px solid #879ca7;">
            <span data-bind="i18n: 'COD Charge: '"></span>
            <span data-bind="text: getCodCharge()"></span>
        </p>
        <div class="checkout-agreements-block">
            <!-- ko foreach: $parent.getRegion('before-place-order') -->
            <!-- ko template: getTemplate() -->
            <!-- /ko -->
            <!--/ko-->
        </div>
        <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>

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.