Jump to content

Get last product deleted from cart


Recommended Posts

Hello !

I am implementing Google analytics 4 in my shop. 

I am sending data to a front controller, then grabbing them with ajax to my javascript file and then firing the event google needs.

As the title says I cant figure out how to get the data from last product that got deleted/removed from cart so I can do what I want with it's data. Is there any function like getLastProduct() -which returns only the last product added- or how can I do this?

Thanks in advance!

Link to comment
Share on other sites

Hello,

There's a hook called actionObjectProductInCartDeleteBefore that is executed before the deletion of a product inside the cart. From it, you have access to the product ID so could retrieve the whole product information. Is it what you need ?

  • Thanks 1
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...