1

i am trying to redirect a user to a custom offline payment method that i have created form one of my phtml file using a button click.

my payment method name is pay by cash.

I have a template where i am listing all the orders.

I want to redirect user to the Pay by Cash payment method and automatically do a place order by Pay by cash method on button click.

please help ! how i can do that.

1 Answer 1

1

in your "method-renderer" you can redirect to your controller action and from there you can render you phtml template :

file location :

Company/Module/view/frontend/web/js/view/payment/method-renderer/paymentname-method.js

code example :

return Component.extend({
       defaults: {
           template: 'compnay_method/payment/paybycash',
                redirectAfterPlaceOrder: false
         },

         /** Returns send check to info */
         getMailingAddress: function() {
             return window.checkoutConfig.payment.checkmo.mailingAddress;
         },
         afterPlaceOrder: function (data, event) {
             // Redirect to your controller action after place order button click
             window.location.replace(url.build('routename/index'));

         }

    });

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.