Jump to content

[SOLVED] Cash on delivery payment module linked to shipping carrier


Recommended Posts

Hello Guys!

I have the trouble here.

I have 2 shipping carriers. And I want to use COD method of payment. What I want to ask...

1) Carrier 1 accepts all payments methods except COD
2) Carrier 2 accepts all payments methods with COD

I don't imagine how to do this. Please help.

Link to comment
Share on other sites

Unfortunately, PrestaShop doesn't let you restrict carriers by payment type. You will need to modify code. Try adding the following after line 447 (the foreach line) of classes/Module.php (in PrestaShop v1.3.2):

if ($module['name'] != 'cashondelivery' OR ($module['name'] == 'cashondelivery' AND $cart->id_carrier != 1))



Change 1 to the ID of the carrier you want to hide "Cash on Delivery".

Link to comment
Share on other sites

  • 7 months later...

I just checked and the code is the same in both PrestaShop v1.3.2 and v1.3.7, so I don't understand the problem. The line above goes after the following line (or maybe before would be more efficient):

if (($moduleInstance = Module::getInstanceByName($module['name'])) AND is_callable(array($moduleInstance, 'hookpayment')))

Link to comment
Share on other sites

  • 2 weeks later...
  • 2 months later...
  • 5 years later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...