Jump to content

Hook to change Cart (enabling/disabling ecotax)


Juan C.

Recommended Posts

Hi everyone:

I need to change product data when they are being added to the cart. I need set ecotax to zero when some data (client, zone, group of client, etc) changes.

In older version of Prestashop I solved this with overriding of Cart class. But I don't want to override classes I want to do it with hooks.

I defined a hook:

 

public function hookactionCartUpdateQuantityBefore(array $params)
{
  $params["product"]->ecotax = 0;
  return $params;
}

This hook runs but data in the cart doesn't change.

If I try with $params["cart"]->_products[0]["ecotax"] = 0; I get 500 server error because _products in cart class is protected.

Can anybody help me?

Thanks!

Link to comment
Share on other sites

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...