Skip to content

Commit

Permalink
little additional type checking for product ID
Browse files Browse the repository at this point in the history
  • Loading branch information
helgatheviking committed Mar 7, 2024
1 parent a224711 commit 9d730f9
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/mix-and-match.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,9 @@ const MixAndMatch = ( { target } ) => {
( mutations ) => {
for ( const mutation of mutations ) {
if ( mutation.type === 'attributes' ) {
const variationId = parseInt(
mutation.target.getAttribute( 'data-variation_id' ),
10
);

let variationId = mutation.target.getAttribute( 'data-variation_id' );
variationId = '' === variationId || isNaN(variationId) ? 0 : parseInt( variationId, 10 );
setContainerId(variationId);

}
}
},
Expand Down

0 comments on commit 9d730f9

Please sign in to comment.