Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions assets/js/src/integrations/classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,11 @@ export function classicTracking(
);

if ( Number.isNaN( productID ) ) {
throw new Error(
// eslint-disable-next-line no-console
console.error(
'Google Analytics for WooCommerce: Could not read product ID from the button given in `added_to_cart` event. Check whether WooCommerce Core events or elements are malformed by other extensions.'
);
return;
}

// If the current product doesn't match search by ID.
Expand Down Expand Up @@ -105,9 +107,11 @@ export function classicTracking(
const productID = parseInt( element.target?.dataset.product_id );

if ( Number.isNaN( productID ) ) {
throw new Error(
// eslint-disable-next-line no-console
console.error(
'Google Analytics for WooCommerce: Could not read product ID from the target element given to remove from cart event. Check whether WooCommerce Core events or elements are malformed by other extensions.'
);
return;
}
getEventHandler( 'remove_from_cart' )( {
product: getProductFromID( productID, products, cart ),
Expand Down