Closed tomalec closed 2 months ago
Do not replace another added_to_cart vanilla handler if there is one.
added_to_cart
Or jQuery event to Vanilla listener hack for added_to_cart may remove any previous listeners if there are any.
For other events: onupdated_wc_div and onremoved_from_cart we prevent that.
onupdated_wc_div
onremoved_from_cart
add_action( 'wp_head', function () { wp_add_inline_script( 'woocommerce-google-analytics-integration', 'document.body.onadded_to_cart = () => { console.log("Other extension listens to added to cart"); };', 'before', ); }, );
Tweak - Do not replace other extensions' add_to_cart listeners.
add_to_cart
Thanks for catching that. :) Fixed in https://github.com/woocommerce/woocommerce-google-analytics-integration/pull/438/commits/dd9211fa3df8a91209f7765722badaf18e65ca83. Would you mind another round @eason9487
Changes proposed in this Pull Request:
Do not replace another
added_to_cart
vanilla handler if there is one.Or jQuery event to Vanilla listener hack for
added_to_cart
may remove any previous listeners if there are any.For other events:
onupdated_wc_div
andonremoved_from_cart
we prevent that.Checks:
Screenshots:
Detailed test instructions:
Additional details:
Changelog entry