Adding an add to cart button on a custom dynamic product page

Hey Sales, yeah I did. I gave up and paid for some help.
This was the code. Works now. Hope that helps!

$w . onReady ( function () {

});

export function addtocartbutton_click ( event ) {

let currentItem = $w ( “#dynamicDataset” ). getCurrentItem ();
let productId = currentItem . _id ;

$w ( '#shoppingCartIcon2' ). addToCart ( productId ,  1 ) 

. then ( () => {
console . log ( ${ productId } added successfully );
} )
. catch ( ( error ) => {
console . log ( error );
} );
}

export function addtocartbutton2_click ( event ) {

let currentItem = $w ( “#dynamicDataset” ). getCurrentItem ();
let productId = currentItem . _id ;

$w ( '#shoppingCartIcon2' ). addToCart ( productId ,  1 ) 

. then ( () => {
console . log ( ${ productId } added successfully );
} )
. catch ( ( error ) => {
console . log ( error );
} );
}