how to reorder the payment methods on front end?
-
29-09-2020 - |
Question
In the payment method section I have three options and are in the following order..
1.checkout with credit card
2.Payment with amazon
3.Pay with paypal
And this method is getting rendered by the following code..
<div class="cart">
<?php if(!$this->hasError()): ?>
<ul class="checkout-types contpdng pdngbtm0">
<?php foreach ($this->getMethods('methods') as $method): ?>
<?php $methodHtml = $this->getMethodHtml($method); ?>
<?php if ($methodHtml): ?>
<li><?php echo $methodHtml; ?></li>
<?php endif; ?>
<?php endforeach; ?>
</ul>
<?php endif; ?>
But I want to reorder it like :
- Pay with paypal
- Payment with amazon
- Checkout with credit card
Could any one suggest how to reorder the payment method in the front end ?
Solution
Magento already has this feature.
For every payment method, there is a configuration field name Sort Order by which you can manage this sort order.
OTHER TIPS
Check on your xml file for this particular payment method, in my case I was entering an order position but it was ignored by the system. added after='-'
or before=''
on the line that inserts the .phtml file used and it worked for the modified payment methods. hope this helps you.
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange