From bca7bfe29c10f914e8a701d48f596ab5a773ea9e Mon Sep 17 00:00:00 2001 From: LuigiPulcini Date: Sat, 14 Jul 2018 16:11:16 +0200 Subject: [PATCH] Adding product data to `removed_from_cart` event Adding `$thisbutton.data()` to the arguments sent by the `removed_from_cart` event. This would help developers easily detect which product has just been removed and alter their theme/plugin accordingly. --- assets/js/frontend/add-to-cart.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/js/frontend/add-to-cart.js b/assets/js/frontend/add-to-cart.js index 4270137de3c..1a82eb4bb37 100644 --- a/assets/js/frontend/add-to-cart.js +++ b/assets/js/frontend/add-to-cart.js @@ -86,7 +86,7 @@ jQuery( function( $ ) { window.location = $thisbutton.attr( 'href' ); return; } - $( document.body ).trigger( 'removed_from_cart', [ response.fragments, response.cart_hash ] ); + $( document.body ).trigger( 'removed_from_cart', [ response.fragments, response.cart_hash, $thisbutton.data() ] ); }).fail( function() { window.location = $thisbutton.attr( 'href' ); return;