Jump to content

Desctivate payment method by categories


malcolm123

Recommended Posts

Hello,

Is there any way by code to not show a payment method (PayPal) when buying a certain product?

Something similar to the module "PayPal surcharge extra fee Module" that includes an option that says "Disable PayPal by Categories" and deactivated by ID

I attach a photo

I would like the same but I do not want to buy the entire module for just this option.

 

I found a code but it is only for the product id and the bank transfer is deactivated. I want it to deactivated Paypal and a whole category

 

public function hookPayment($params)
{
$products = $this->context->cart->getProducts();

if($products)

{
foreach ($products as $productos) {
if ($productos['id_product'] == 2)
{
return;
}
}
}

if (!$this->active)
return;
if (!$this->checkCurrency($params['cart']))
return;

$this->smarty->assign(array(
'this_path' => $this->_path,
'this_path_bw' => $this->_path,
'this_path_ssl' => Tools::getShopDomainSsl(true, true).__PS_BASE_URI__.'modules/'.$this->name.'/'
));
return $this->display(__FILE__, 'payment.tpl');
}

 

Thank you,

 

Regards!

paypal-surcharge-extra-fee.jpg

Link to comment
Share on other sites

  • 2 weeks 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...