Jump to content

Additional actions when the cart is changed.


Recommended Posts

I need to do additional actions when the cart is changed.
I need to read the content of the cart and then check a set of conditions. So, I need to know how to put my set of conditions (a function). 
I want to print an error in the cart summary so I need my function to be executed when a product is changed (add or remove) in that screen.
Can I use a module and put my function on it?

This not work for me:

 

public function hookActionCartSave(){
      return $this->checkMyCart();
}

protected function checkMyCart(){
    // My code gos here..

    $this->errors[] = $this->trans(
                $my_error_msg,
                array(),
                'Shop.Notifications.Error'
            );
}

 

 

Share this post


Link to post
Share on other sites

Hi,

Create   a  new  module  and  implement  your  code  inside  it.

The  conditions  will take  effect  since  you  are  calling  the  right   hook.

Share this post


Link to post
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...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More