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.
This commit is contained in:
LuigiPulcini 2018-07-14 16:11:16 +02:00 committed by GitHub
parent ef00985e44
commit bca7bfe29c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -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;