Jump to content
  • Checkout
  • Login
  • Get in touch


The e-commerce.

Disable a shipping option or payment option during checkout


Recommended Posts

I have written a couple of shipping and payment modules to fit my needs and I have a proposal for the core team - a way to disable a shipping option or payment option during the checkout process with a message why the option is not enabled.


I would like to "disable" some shipping and/or payment options depending on order value and order weight, etc. I found that it's easy to disable a shipping option in a shipping module by setting the 'error' field of the qoutes array in the function quote:




The file "checkout_shipping.php" is then displaying the message and the option is not able to select (i.e the radio box is not even printed).


I had the same idea when implementing my payment module. This time I am setting the 'error' field of returning array in function selection:




The message is displayed fine but the things is that it is still possible to select the payment option (due to that the radio box is printed). So I changed the logic in "checkout_payment.php" according to this (please note the if statement tagged with Fred):


  $selection = $payment_modules->selection();


 $radio_buttons = 0;

 for ($i=0, $n=sizeof($selection); $i<$n; $i++) {




   if (!isset($selection[$i]['error'])) { //Fred - added to be able to disable a payment module

     if (sizeof($selection) > 1) {

       echo tep_draw_radio_field('payment', $selection[$i]['id']);

     } else {

       echo tep_draw_hidden_field('payment', $selection[$i]['id']);


   } //Fred - added to be able to disable a payment module





I know I can set $this->enabled = false in the update_status function, the only issue with this is that the payment option is not displayed and the user may not know why the option isn't there.


What I am asking for is the some logic in both shipping and payment stage.



Link to comment
Share on other sites

  • 2 weeks later...


This topic is now archived and is closed to further replies.

  • Create New...