Set adding_to_cart trigger to variable. If false, do not fire ajax. Closes #25759.
This commit is contained in:
parent
4138aecdcd
commit
38e081e590
|
@ -76,8 +76,9 @@ jQuery( function( $ ) {
|
|||
});
|
||||
|
||||
// Trigger event.
|
||||
$( document.body ).trigger( 'adding_to_cart', [ $thisbutton, data ] );
|
||||
var valid = $( document.body ).triggerHandler( 'adding_to_cart', [ $thisbutton, data ] );
|
||||
|
||||
if( valid !== false ) {
|
||||
e.data.addToCartHandler.addRequest({
|
||||
type: 'POST',
|
||||
url: wc_add_to_cart_params.wc_ajax_url.toString().replace( '%%endpoint%%', 'add_to_cart' ),
|
||||
|
@ -104,6 +105,7 @@ jQuery( function( $ ) {
|
|||
dataType: 'json'
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue