Title: Remove From Cart JavaScript Hook
Last modified: August 22, 2020

---

# Remove From Cart JavaScript Hook

 *  Resolved [animesaulo](https://wordpress.org/support/users/animesaulo/)
 * (@animesaulo)
 * [5 years, 9 months ago](https://wordpress.org/support/topic/remove-from-cart-javascript-hook/)
 * I love the JavaScript Hooks. They’re great when implementing Google Analytics
   Enhanced Ecommerce on a website using the WP Shopify Plugin. But, one JavaScript
   Hook that would be great would be to detect when an item has been removed from
   the cart.
 * You already have the JavaScript Hooks for:
    - before.product.addToCart
    - after.product.addToCart
 * Can you add 2 more like:
    - before.product.removeFromCart
    - after.product.removeFromCart
 * To detect when the product is removed from the cart using the “Remove” link or
   when the quantity reaches “0” and provides the “lineItem” and “variants” removed.

Viewing 4 replies - 1 through 4 (of 4 total)

 *  Plugin Author [andrewmrobbins](https://wordpress.org/support/users/andrewmrobbins/)
 * (@andrewmrobbins)
 * [5 years, 9 months ago](https://wordpress.org/support/topic/remove-from-cart-javascript-hook/#post-13304817)
 * [@animesaulo](https://wordpress.org/support/users/animesaulo/)
 * Hey there,
 * I can definitely add these two hooks for you! I’ll get them rolled into the next
   plugin update.
 * Thanks for the recommendation!
 *  Plugin Author [andrewmrobbins](https://wordpress.org/support/users/andrewmrobbins/)
 * (@andrewmrobbins)
 * [5 years, 9 months ago](https://wordpress.org/support/topic/remove-from-cart-javascript-hook/#post-13312693)
 * Hey [@animesaulo](https://wordpress.org/support/users/animesaulo/)
 * I just finished pushing out version `3.2.3` which contains the new JS action:`
   after.cart.lineItem.remove`.
 * I’ve updated the docs with instructions on how to use it as well. You can find
   it here: [https://docs.wpshop.io/#/js/actions/cart?id=aftercartlineitemremove](https://docs.wpshop.io/#/js/actions/cart?id=aftercartlineitemremove)
 * Let me know if you have any questions / concerns!
 *  Thread Starter [animesaulo](https://wordpress.org/support/users/animesaulo/)
 * (@animesaulo)
 * [5 years, 9 months ago](https://wordpress.org/support/topic/remove-from-cart-javascript-hook/#post-13341630)
 * The JS action is working great. I’m now able to track the “remove from cart” 
   event in Google Analytics Enhanced Ecommerce. Thanks again Andrew.
 *  Plugin Author [andrewmrobbins](https://wordpress.org/support/users/andrewmrobbins/)
 * (@andrewmrobbins)
 * [5 years, 9 months ago](https://wordpress.org/support/topic/remove-from-cart-javascript-hook/#post-13342066)
 * [@animesaulo](https://wordpress.org/support/users/animesaulo/) Ah, interesting!
 * No problem at all.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Remove From Cart JavaScript Hook’ is closed to new replies.

 * ![](https://ps.w.org/wpshopify/assets/icon.svg?rev=2740857)
 * [ShopWP](https://wordpress.org/plugins/wpshopify/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wpshopify/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wpshopify/)
 * [Active Topics](https://wordpress.org/support/plugin/wpshopify/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wpshopify/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wpshopify/reviews/)

 * 4 replies
 * 2 participants
 * Last reply from: [andrewmrobbins](https://wordpress.org/support/users/andrewmrobbins/)
 * Last activity: [5 years, 9 months ago](https://wordpress.org/support/topic/remove-from-cart-javascript-hook/#post-13342066)
 * Status: resolved